summaryrefslogtreecommitdiff
path: root/config/routes/user.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /config/routes/user.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'config/routes/user.rb')
-rw-r--r--config/routes/user.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/config/routes/user.rb b/config/routes/user.rb
index 0c1bc1956a9..1c122ea0c94 100644
--- a/config/routes/user.rb
+++ b/config/routes/user.rb
@@ -55,6 +55,22 @@ devise_scope :user do
get '/users/almost_there' => 'confirmations#almost_there'
post '/users/resend_verification_code', to: 'sessions#resend_verification_code'
get '/users/successful_verification', to: 'sessions#successful_verification'
+
+ # Redirect on GitHub authorization request errors. E.g. it could happen when user:
+ # 1. cancel authorization the GitLab OAuth app via GitHub to import GitHub repos
+ # (they'll be redirected to /projects/new#import_project)
+ # 2. cancel signing in to GitLab using GitHub account
+ # (they'll be redirected to /users/sign_in)
+ # In these cases, GitHub redirects user to the GitLab OAuth app's
+ # registered callback URL - /users/auth, which is the url to the auth user's profile page
+ get '/users/auth',
+ constraints: ->(req) {
+ req.params[:error].present? && req.params[:state].present?
+ },
+ to: redirect { |_params, req|
+ redirect_path = req.session.delete(:auth_on_failure_path)
+ redirect_path || Rails.application.routes.url_helpers.new_user_session_path
+ }
end
scope '-/users', module: :users do