Activate device email change confirmation
This commit is contained in:
parent
d68d2be798
commit
0f9fdf3f75
5 changed files with 10 additions and 1 deletions
|
@ -121,7 +121,7 @@ Devise.setup do |config|
|
||||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||||
# db field (see migrations). Until confirmed, new email is stored in
|
# db field (see migrations). Until confirmed, new email is stored in
|
||||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||||
config.reconfirmable = false
|
config.reconfirmable = true
|
||||||
|
|
||||||
# Defines which key will be used when confirming an account
|
# Defines which key will be used when confirming an account
|
||||||
# config.confirmation_keys = [ :email ]
|
# config.confirmation_keys = [ :email ]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUnconfirmedEmailColumnToUsers < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :users, :unconfirmed_email, :text
|
||||||
|
end
|
||||||
|
end
|
|
@ -605,6 +605,7 @@ ActiveRecord::Schema.define(version: 2019_07_04_144304) do
|
||||||
t.string "confirmation_token"
|
t.string "confirmation_token"
|
||||||
t.datetime "confirmed_at"
|
t.datetime "confirmed_at"
|
||||||
t.datetime "confirmation_sent_at"
|
t.datetime "confirmation_sent_at"
|
||||||
|
t.text "unconfirmed_email"
|
||||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
|
|
@ -6,6 +6,7 @@ feature 'Administrator connection' do
|
||||||
let(:email) { 'admin1@admin.com' }
|
let(:email) { 'admin1@admin.com' }
|
||||||
let(:password) { 'mon chien aime les bananes' }
|
let(:password) { 'mon chien aime les bananes' }
|
||||||
let!(:admin) { create(:administrateur, :with_procedure, email: email, password: password) }
|
let!(:admin) { create(:administrateur, :with_procedure, email: email, password: password) }
|
||||||
|
let!(:user) { create(:user, email: email, password: password) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
|
||||||
|
|
|
@ -107,6 +107,7 @@ describe User, type: :model do
|
||||||
gestionnaire = create(:gestionnaire, email: user.email)
|
gestionnaire = create(:gestionnaire, email: user.email)
|
||||||
|
|
||||||
user.update(email: 'whoami@plop.com', password: 'super secret')
|
user.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
user.confirm
|
||||||
|
|
||||||
gestionnaire.reload
|
gestionnaire.reload
|
||||||
expect(gestionnaire.email).to eq('whoami@plop.com')
|
expect(gestionnaire.email).to eq('whoami@plop.com')
|
||||||
|
@ -118,6 +119,7 @@ describe User, type: :model do
|
||||||
admin = create(:administrateur, email: user.email)
|
admin = create(:administrateur, email: user.email)
|
||||||
|
|
||||||
user.update(email: 'whoami@plop.com', password: 'super secret')
|
user.update(email: 'whoami@plop.com', password: 'super secret')
|
||||||
|
user.confirm
|
||||||
|
|
||||||
admin.reload
|
admin.reload
|
||||||
expect(admin.email).to eq('whoami@plop.com')
|
expect(admin.email).to eq('whoami@plop.com')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue