2014-07-11 06:24:11 -04:00
|
|
|
class SessionsController < Devise::SessionsController
|
|
|
|
|
|
|
|
def new
|
2014-07-25 12:30:25 -04:00
|
|
|
redirect_path = if request.referer.present? && (params['redirect_to_referer'] == 'yes')
|
2014-07-22 02:34:16 -04:00
|
|
|
referer_uri = URI(request.referer)
|
|
|
|
if referer_uri.host == Gitlab.config.gitlab.host
|
|
|
|
referer_uri.path
|
|
|
|
else
|
|
|
|
request.fullpath
|
|
|
|
end
|
|
|
|
else
|
|
|
|
request.fullpath
|
|
|
|
end
|
|
|
|
|
2014-07-25 12:30:25 -04:00
|
|
|
# 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 == '/users/sign_in'
|
|
|
|
store_location_for(:redirect, redirect_path)
|
|
|
|
end
|
2014-07-11 06:24:11 -04:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|