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-05-06 05:16:09 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-05-10 00:32:05 +0300
commit66bc758e2b9ba736035d036b25b17bdbb83c39b3 (patch)
tree41e953ba382d3a6129d61c0fe376743019d4b99d /app/models/user.rb
parent6fa294292058dd5ab9bd089c446b3017aa85b868 (diff)
Update User model for two-factor auth
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index befbcbf1a16..7b1f6fae3be 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -73,8 +73,11 @@ class User < ActiveRecord::Base
default_value_for :hide_no_password, false
default_value_for :theme_id, gitlab_config.default_theme
- devise :lockable, :async,
- :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable
+ devise :two_factor_authenticatable,
+ otp_secret_encryption_key: File.read(Rails.root.join('.secret')).chomp
+ devise :two_factor_backupable
+ devise :lockable, :async, :recoverable, :rememberable, :trackable,
+ :validatable, :omniauthable, :confirmable, :registerable
attr_accessor :force_random_password
@@ -663,4 +666,9 @@ class User < ActiveRecord::Base
true
end
+
+ # Used to populate the hidden form field during Two-factor authentication
+ def login
+ username || email
+ end
end