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
Tatuya Kamada
gitlab-ce
Commits
7b879bb8
Commit
7b879bb8
authored
May 23, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump secret key length to 32
parent
e73ea126
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
app/controllers/profiles/two_factor_auths_controller.rb
app/controllers/profiles/two_factor_auths_controller.rb
+1
-1
spec/controllers/profiles/two_factor_auths_controller_spec.rb
.../controllers/profiles/two_factor_auths_controller_spec.rb
+1
-1
spec/factories.rb
spec/factories.rb
+1
-1
No files found.
app/controllers/profiles/two_factor_auths_controller.rb
View file @
7b879bb8
class
Profiles::TwoFactorAuthsController
<
Profiles
::
ApplicationController
class
Profiles::TwoFactorAuthsController
<
Profiles
::
ApplicationController
def
new
def
new
unless
current_user
.
otp_secret
unless
current_user
.
otp_secret
current_user
.
otp_secret
=
User
.
generate_otp_secret
(
16
)
current_user
.
otp_secret
=
User
.
generate_otp_secret
(
32
)
current_user
.
save!
current_user
.
save!
end
end
...
...
spec/controllers/profiles/two_factor_auths_controller_spec.rb
View file @
7b879bb8
...
@@ -12,7 +12,7 @@ describe Profiles::TwoFactorAuthsController do
...
@@ -12,7 +12,7 @@ describe Profiles::TwoFactorAuthsController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'generates otp_secret for user'
do
it
'generates otp_secret for user'
do
expect
(
User
).
to
receive
(
:generate_otp_secret
).
with
(
16
).
and_return
(
'secret'
).
once
expect
(
User
).
to
receive
(
:generate_otp_secret
).
with
(
32
).
and_return
(
'secret'
).
once
get
:new
get
:new
get
:new
# Second hit shouldn't re-generate it
get
:new
# Second hit shouldn't re-generate it
...
...
spec/factories.rb
View file @
7b879bb8
...
@@ -31,7 +31,7 @@ FactoryGirl.define do
...
@@ -31,7 +31,7 @@ FactoryGirl.define do
trait
:two_factor
do
trait
:two_factor
do
before
(
:create
)
do
|
user
|
before
(
:create
)
do
|
user
|
user
.
otp_required_for_login
=
true
user
.
otp_required_for_login
=
true
user
.
otp_secret
=
User
.
generate_otp_secret
(
16
)
user
.
otp_secret
=
User
.
generate_otp_secret
(
32
)
end
end
end
end
...
...
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