Devise: confirm user email
This commit is contained in:
parent
2b9721f1ee
commit
5bd589344e
10 changed files with 53 additions and 4 deletions
18
db/migrate/20180514091001_add_confirmable_to_user_devise.rb
Normal file
18
db/migrate/20180514091001_add_confirmable_to_user_devise.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class AddConfirmableToUserDevise < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
add_column :users, :confirmation_token, :string
|
||||
add_column :users, :confirmed_at, :datetime
|
||||
add_column :users, :confirmation_sent_at, :datetime
|
||||
add_index :users, :confirmation_token, unique: true
|
||||
# User.reset_column_information # Need for some types of updates, but not for update_all.
|
||||
# To avoid a short time window between running the migration and updating all existing
|
||||
# users as confirmed, do the following
|
||||
User.all.update_all confirmed_at: DateTime.now
|
||||
# All existing user accounts should be able to log in after this.
|
||||
end
|
||||
|
||||
def down
|
||||
remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at
|
||||
# remove_columns :users, :unconfirmed_email # Only if using reconfirmable
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue