Defect #35417 » 2fa-session-reset.patch
| app/controllers/twofa_controller.rb | ||
|---|---|---|
|
def activate
|
||
|
if @twofa.confirm_pairing!(params[:twofa_code].to_s)
|
||
|
# The session token was destroyed by the twofa pairing, generate a new one
|
||
|
session[:tk] = @user.generate_session_token
|
||
|
flash[:notice] = l('twofa_activated', bc_path: my_twofa_backup_codes_init_path)
|
||
|
redirect_to my_account_path
|
||
|
else
|
||
| app/models/user.rb | ||
|---|---|---|
|
# This helps to keep the account secure in case the associated email account
|
||
|
# was compromised.
|
||
|
def destroy_tokens
|
||
|
if saved_change_to_hashed_password? || (saved_change_to_status? && !active?)
|
||
|
if saved_change_to_hashed_password? || (saved_change_to_status? && !active?) || (saved_change_to_twofa_scheme? && twofa_scheme.present?)
|
||
|
tokens = ['recovery', 'autologin', 'session']
|
||
|
Token.where(:user_id => id, :action => tokens).delete_all
|
||
|
end
|
||