diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-06-30 13:29:34 +0000 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-06-30 13:45:51 +0000 |
commit | 5dedea358dc3012b4c2a876065c16cf748fbf7ea (patch) | |
tree | fe98aaca557bb4c1e4bced6f1a8508c63c1587a0 /lib/api/internal.rb | |
parent | 3c88a7869b87693ba8c3fb9814d39437dd569a31 (diff) | |
parent | 81dba76b9d7d120cd22e3619a4058bd4885be9bc (diff) | |
download | gitlab-ce-5dedea358dc3012b4c2a876065c16cf748fbf7ea.tar.gz |
Merge remote-tracking branch 'origin/master' into 34141-allow-unauthenticated-access-to-the-users-api
- Modify policy code to work with the `DeclarativePolicy` refactor
in 37c401433b76170f0150d70865f1f4584db01fa8.
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r-- | lib/api/internal.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 479ee16a611..f1c79970ba4 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -132,8 +132,11 @@ module API return { success: false, message: 'Two-factor authentication is not enabled for this user' } end - codes = user.generate_otp_backup_codes! - user.save! + codes = nil + + ::Users::UpdateService.new(user).execute! do |user| + codes = user.generate_otp_backup_codes! + end { success: true, recovery_codes: codes } end |