summaryrefslogtreecommitdiff
path: root/app/controllers/profiles
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-31 22:42:17 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-05-09 17:31:37 -0400
commit802fcd051fcbc9be99230bddb13c4a7cb8067741 (patch)
tree9cadf6f58acc76b0a882980d7c3909ddeeac429c /app/controllers/profiles
parentb66be0a2b3351dd10d96e3d0d0576f6d1444f342 (diff)
downloadgitlab-ce-802fcd051fcbc9be99230bddb13c4a7cb8067741.tar.gz
Add support for backup codes
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index 9b4070a76f7..2841a07efbc 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -21,6 +21,12 @@ class Profiles::TwoFactorAuthsController < ApplicationController
end
end
+ def codes
+ codes = current_user.generate_otp_backup_codes!
+ current_user.save!
+ send_data codes.join("\n"), filename: 'gitlab_recovery_codes.txt'
+ end
+
def destroy
current_user.otp_required_for_login = false
current_user.save!