Skip to content
Snippets Groups Projects
Commit 7edb608c authored by luandalmazo's avatar luandalmazo
Browse files

Issue #9: ADD task that confirm old emails

parent cd403258
No related branches found
No related tags found
2 merge requests!17Curatorship and Gamification done,!7Issue #9: ADD task that confirm old emails
Pipeline #30017 failed
...@@ -55,6 +55,15 @@ require 'open-uri' ...@@ -55,6 +55,15 @@ require 'open-uri'
else else
render_create_error_bad_credentials render_create_error_bad_credentials
end end
end
def render_create_error_not_confirmed
render json: {
success: false,
errors: [ I18n.t("devise.failure.unconfirmed")],
}, status: 401
end end
def render_create_error_banished def render_create_error_banished
......
...@@ -539,4 +539,5 @@ class User < ApplicationRecord ...@@ -539,4 +539,5 @@ class User < ApplicationRecord
def complaint_reject(params) def complaint_reject(params)
end end
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