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:
authorRobert Speicher <rspeicher@gmail.com>2015-07-10 23:08:39 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-07-10 23:18:30 +0300
commit22724418d350001e2683b68fad65186af783d3f2 (patch)
treede5038198d8ab98bc9d592ce4a1437493010d30a /app/models
parent526813581b042bc6abad60eb4e582be81620be77 (diff)
Add User#disable_two_factor!
This method encapsulates all the logic for disabling 2FA on a specific User model.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index dc84f5141d8..317257a2500 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -322,6 +322,16 @@ class User < ActiveRecord::Base
@reset_token
end
+ def disable_two_factor!
+ update_attributes(
+ two_factor_enabled: false,
+ encrypted_otp_secret: nil,
+ encrypted_otp_secret_iv: nil,
+ encrypted_otp_secret_salt: nil,
+ otp_backup_codes: nil
+ )
+ end
+
def namespace_uniq
namespace_name = self.username
existing_namespace = Namespace.by_path(namespace_name)