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
051324e1
Commit
051324e1
authored
Apr 19, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `authenticate_user_from_private_token!`
- No need to use `if`s when we have a `presence` check already.
parent
ade40fdc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
application_controller.rb
app/controllers/application_controller.rb
+1
-7
No files found.
app/controllers/application_controller.rb
View file @
051324e1
...
@@ -67,13 +67,7 @@ class ApplicationController < ActionController::Base
...
@@ -67,13 +67,7 @@ class ApplicationController < ActionController::Base
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
def
authenticate_user_from_private_token!
def
authenticate_user_from_private_token!
user_token
=
if
params
[
:authenticity_token
].
presence
user_token
=
params
[
:authenticity_token
].
presence
||
params
[
:private_token
].
presence
||
request
.
headers
[
'PRIVATE-TOKEN'
].
presence
params
[
:authenticity_token
].
presence
elsif
params
[
:private_token
].
presence
params
[
:private_token
].
presence
elsif
request
.
headers
[
'PRIVATE-TOKEN'
].
present?
request
.
headers
[
'PRIVATE-TOKEN'
]
end
user
=
user_token
&&
User
.
find_by_authentication_token
(
user_token
.
to_s
)
user
=
user_token
&&
User
.
find_by_authentication_token
(
user_token
.
to_s
)
if
user
if
user
...
...
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