Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/profiles/two_factor_auths_controller.rb')
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index a8b7e756ad1..95e05dff80a 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -41,9 +41,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
def create
if current_user.validate_and_consume_otp!(params[:pin_code])
- current_user.otp_required_for_login = true
- @codes = current_user.generate_otp_backup_codes!
- Users::UpdateService.new(current_user, current_user).execute!
+ Users::UpdateService.new(current_user, current_user).execute! do |user|
+ user.otp_required_for_login = true
+ @codes = user.generate_otp_backup_codes!
+ end
render 'create'
else
@@ -70,8 +71,9 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
end
def codes
- @codes = current_user.generate_otp_backup_codes!
- Users::UpdateService.new(current_user, current_user).execute!
+ Users::UpdateService.new(current_user, current_user).execute! do |user|
+ @codes = user.generate_otp_backup_codes!
+ end
end
def destroy