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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fb6e8008
Commit
fb6e8008
authored
Aug 12, 2015
by
Alex Lossent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix redirection after sign in when using auto_sign_in_with_provider
Logic for redirect path moved to a filter.
parent
cd579cb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
CHANGELOG
CHANGELOG
+1
-0
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+21
-18
No files found.
CHANGELOG
View file @
fb6e8008
...
...
@@ -56,6 +56,7 @@ v 7.14.0 (unreleased)
- Include branch/tag name in archive file and directory name
- Add dropzone upload progress
- Add a label for merged branches on branches page (Florent Baldino)
- Fix redirection after sign in when using auto_sign_in_with_provider
v 7.13.3
- Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
...
...
app/controllers/sessions_controller.rb
View file @
fb6e8008
...
...
@@ -2,27 +2,10 @@ class SessionsController < Devise::SessionsController
include
AuthenticatesWithTwoFactor
prepend_before_action
:authenticate_with_two_factor
,
only:
[
:create
]
prepend_before_action
:store_redirect_path
,
only:
[
:new
]
before_action
:auto_sign_in_with_provider
,
only:
[
:new
]
def
new
redirect_path
=
if
request
.
referer
.
present?
&&
(
params
[
'redirect_to_referer'
]
==
'yes'
)
referer_uri
=
URI
(
request
.
referer
)
if
referer_uri
.
host
==
Gitlab
.
config
.
gitlab
.
host
referer_uri
.
path
else
request
.
fullpath
end
else
request
.
fullpath
end
# Prevent a 'you are already signed in' message directly after signing:
# we should never redirect to '/users/sign_in' after signing in successfully.
unless
redirect_path
==
new_user_session_path
store_location_for
(
:redirect
,
redirect_path
)
end
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
Gitlab
::
LDAP
::
Config
.
servers
end
...
...
@@ -55,6 +38,26 @@ class SessionsController < Devise::SessionsController
User
.
find
(
session
[
:otp_user_id
])
end
end
def
store_redirect_path
redirect_path
=
if
request
.
referer
.
present?
&&
(
params
[
'redirect_to_referer'
]
==
'yes'
)
referer_uri
=
URI
(
request
.
referer
)
if
referer_uri
.
host
==
Gitlab
.
config
.
gitlab
.
host
referer_uri
.
path
else
request
.
fullpath
end
else
request
.
fullpath
end
# Prevent a 'you are already signed in' message directly after signing:
# we should never redirect to '/users/sign_in' after signing in successfully.
unless
redirect_path
==
new_user_session_path
store_location_for
(
:redirect
,
redirect_path
)
end
end
def
authenticate_with_two_factor
user
=
self
.
resource
=
find_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