BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
76f7e804
Commit
76f7e804
authored
Dec 23, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix method that ensures authentication token
Until now, `ensure_#{token_filed_name}` method didn't persist new token in database. This closes #4235.
parent
3b61dc47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
token_authenticatable.rb
app/models/concerns/token_authenticatable.rb
+2
-6
token_authenticatable_spec.rb
spec/models/concerns/token_authenticatable_spec.rb
+4
-0
No files found.
app/models/concerns/token_authenticatable.rb
View file @
76f7e804
...
...
@@ -17,12 +17,8 @@ module TokenAuthenticatable
end
define_method
(
"ensure_
#{
token_field
}
"
)
do
current_token
=
read_attribute
(
token_field
)
if
current_token
.
blank?
write_attribute
(
token_field
,
generate_token_for
(
token_field
))
else
current_token
end
send
(
"reset_
#{
token_field
}
!"
)
if
read_attribute
(
token_field
).
blank?
read_attribute
(
token_field
)
end
define_method
(
"reset_
#{
token_field
}
!"
)
do
...
...
spec/models/concerns/token_authenticatable_spec.rb
View file @
76f7e804
...
...
@@ -35,6 +35,10 @@ describe ApplicationSetting, 'TokenAuthenticatable' do
it
{
is_expected
.
to
be_a
String
}
it
{
is_expected
.
to_not
be_blank
}
it
'should persist new token'
do
expect
(
subject
).
to
eq
described_class
.
current
[
token_field
]
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