Skip to content
Snippets Groups Projects
Commit b29a20bd authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

Merge branch 'issue/9-task-email-confirmation-old-users' into 'develop'

Issue #9: ADD task that confirm old emails

See merge request rfhf19/cleanning-portalmec!7
parents 4ec44259 7edb608c
No related branches found
No related tags found
2 merge requests!17Curatorship and Gamification done,!7Issue #9: ADD task that confirm old emails
Pipeline #30019 failed
......@@ -571,4 +571,5 @@ class User < ApplicationRecord
def complaint_reject(params)
end
end
class ModifyUsersTable < ActiveRecord::Migration[7.0]
def change
change_table(:users) do |t|
## Lockable
t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
end
end
end
namespace :access do
desc 'Check when all users was created, and give access to them if they were created before a certain date'
base_date = Date.new(2022, 7, 20)
task :confirm_old_emails => :environment do
User.all.each do |user|
if user.created_at < base_date
user.update_attribute(:email_confirmed, true)
end
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment