diff options
author | James Lopez <james@jameslopez.es> | 2017-06-22 11:27:37 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-06-23 11:41:42 +0200 |
commit | c9fd3dc42c462ce2551f6a9630035b4df00bc366 (patch) | |
tree | 5e4bd5226fff9fa00ba9db17056d21a59db527d7 /app/controllers/profiles | |
parent | 785cbb79e255c8369ca5eb916207304f39d188ad (diff) | |
download | gitlab-ce-c9fd3dc42c462ce2551f6a9630035b4df00bc366.tar.gz |
more refactoring based on feedback
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r-- | app/controllers/profiles/avatars_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/profiles/two_factor_auths_controller.rb | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/profiles/avatars_controller.rb b/app/controllers/profiles/avatars_controller.rb index 538604f8866..cab9ea24270 100644 --- a/app/controllers/profiles/avatars_controller.rb +++ b/app/controllers/profiles/avatars_controller.rb @@ -1,9 +1,10 @@ class Profiles::AvatarsController < Profiles::ApplicationController def destroy @user = current_user - @user.remove_avatar! - Users::UpdateService.new(@user, @user).execute + Users::UpdateService.new(@user, @user).execute do |user| + user.remove_avatar! + end redirect_to profile_path, status: 302 end 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 |