Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
c845347b
Commit
c845347b
authored
May 09, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate 10 2FA backup codes instead of the default of 5
parent
5f43cae6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/user.rb
app/models/user.rb
+1
-1
spec/features/login_spec.rb
spec/features/login_spec.rb
+2
-2
No files found.
app/models/user.rb
View file @
c845347b
...
@@ -81,7 +81,7 @@ class User < ActiveRecord::Base
...
@@ -81,7 +81,7 @@ class User < ActiveRecord::Base
devise
:two_factor_authenticatable
,
devise
:two_factor_authenticatable
,
otp_secret_encryption_key:
File
.
read
(
Rails
.
root
.
join
(
'.secret'
)).
chomp
otp_secret_encryption_key:
File
.
read
(
Rails
.
root
.
join
(
'.secret'
)).
chomp
devise
:two_factor_backupable
devise
:two_factor_backupable
,
otp_number_of_backup_codes:
10
serialize
:otp_backup_codes
,
JSON
serialize
:otp_backup_codes
,
JSON
devise
:lockable
,
:async
,
:recoverable
,
:rememberable
,
:trackable
,
devise
:lockable
,
:async
,
:recoverable
,
:rememberable
,
:trackable
,
...
...
spec/features/login_spec.rb
View file @
c845347b
...
@@ -39,7 +39,7 @@ feature 'Login' do
...
@@ -39,7 +39,7 @@ feature 'Login' do
let
(
:codes
)
{
user
.
generate_otp_backup_codes!
}
let
(
:codes
)
{
user
.
generate_otp_backup_codes!
}
before
do
before
do
expect
(
codes
.
size
).
to
eq
5
expect
(
codes
.
size
).
to
eq
10
# Ensure the generated codes get saved
# Ensure the generated codes get saved
user
.
save
user
.
save
...
@@ -63,7 +63,7 @@ feature 'Login' do
...
@@ -63,7 +63,7 @@ feature 'Login' do
expect
(
user
.
invalidate_otp_backup_code!
(
code
)).
to
eq
true
expect
(
user
.
invalidate_otp_backup_code!
(
code
)).
to
eq
true
user
.
save!
user
.
save!
expect
(
user
.
reload
.
otp_backup_codes
.
size
).
to
eq
4
expect
(
user
.
reload
.
otp_backup_codes
.
size
).
to
eq
9
enter_code
(
code
)
enter_code
(
code
)
expect
(
page
).
to
have_content
(
'Invalid two-factor code'
)
expect
(
page
).
to
have_content
(
'Invalid two-factor code'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment