Commit 1be777b155cde4b738dcd8ef77edc852eeecadb5
1 parent
528e677b
Exists in
master
and in
2 other branches
Fixed double redirect url
Showing
1 changed file
with
10 additions
and
10 deletions
Show diff stats
lib/omniauth/strategies/remote_user.rb
| @@ -2,7 +2,7 @@ module OmniAuth | @@ -2,7 +2,7 @@ module OmniAuth | ||
| 2 | module Strategies | 2 | module Strategies |
| 3 | class RemoteUser | 3 | class RemoteUser |
| 4 | include OmniAuth::Strategy | 4 | include OmniAuth::Strategy |
| 5 | - | 5 | + |
| 6 | option :cookie, '_gitlab_session' | 6 | option :cookie, '_gitlab_session' |
| 7 | option :internal_cookie, '_remote_user' | 7 | option :internal_cookie, '_remote_user' |
| 8 | 8 | ||
| @@ -40,11 +40,10 @@ module OmniAuth | @@ -40,11 +40,10 @@ module OmniAuth | ||
| 40 | 40 | ||
| 41 | def __logout(env) | 41 | def __logout(env) |
| 42 | request = Rack::Request.new(env) | 42 | request = Rack::Request.new(env) |
| 43 | - response = redirect_if_not_logging_in(request, request.path) | 43 | + response = redirect_if_not_logging_in(request, sign_out_path ) |
| 44 | if response | 44 | if response |
| 45 | response.delete_cookie(options.cookie) | 45 | response.delete_cookie(options.cookie) |
| 46 | response.delete_cookie(options.internal_cookie) | 46 | response.delete_cookie(options.internal_cookie) |
| 47 | - response.redirect sign_out_path | ||
| 48 | response | 47 | response |
| 49 | end | 48 | end |
| 50 | end | 49 | end |
| @@ -65,8 +64,9 @@ module OmniAuth | @@ -65,8 +64,9 @@ module OmniAuth | ||
| 65 | 64 | ||
| 66 | def redirect_if_not_logging_in(request, url) | 65 | def redirect_if_not_logging_in(request, url) |
| 67 | if ! [ | 66 | if ! [ |
| 68 | - auth_path, | ||
| 69 | - callback_path | 67 | + sign_out_path, |
| 68 | + auth_path, | ||
| 69 | + callback_path | ||
| 70 | ].include?(request.path_info) | 70 | ].include?(request.path_info) |
| 71 | response = Rack::Response.new | 71 | response = Rack::Response.new |
| 72 | response.redirect url | 72 | response.redirect url |
| @@ -94,17 +94,17 @@ module OmniAuth | @@ -94,17 +94,17 @@ module OmniAuth | ||
| 94 | end | 94 | end |
| 95 | 95 | ||
| 96 | def callback_path | 96 | def callback_path |
| 97 | - "#{auth_path}/callback" | 97 | + "#{auth_path}/callback" |
| 98 | end | 98 | end |
| 99 | 99 | ||
| 100 | def auth_path | 100 | def auth_path |
| 101 | - "#{path_prefix}/RemoteUser" | 101 | + "#{path_prefix}/RemoteUser" |
| 102 | end | 102 | end |
| 103 | - | 103 | + |
| 104 | def sign_out_path | 104 | def sign_out_path |
| 105 | - '/users/sign_out' | 105 | + '/users/sign_out' |
| 106 | end | 106 | end |
| 107 | - | 107 | + |
| 108 | end | 108 | end |
| 109 | end | 109 | end |
| 110 | end | 110 | end |