diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 03:11:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 03:11:02 +0000 |
commit | 66664611361dcfcbaf99cd7c6906b99bcb16becd (patch) | |
tree | 0b0c6b2266d5e6ea24e996cf7f5cf06ad523d9df /config/routes/user.rb | |
parent | 7e89568aa1b1c531aa34860fbd9e77d9e988b9b2 (diff) | |
download | gitlab-ce-66664611361dcfcbaf99cd7c6906b99bcb16becd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config/routes/user.rb')
-rw-r--r-- | config/routes/user.rb | 16 |
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 |