Fix wrong redirect after sign-in for RS OAuth
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s

We use a custom auth method to pre-fill the username when reaching the
RS OAuth while signed out. However, it needs to redirect back to the RS
OAuth page after sign-in, and not to the root path.
This commit is contained in:
Râu Cao
2023-09-04 11:33:16 +02:00
parent 0f3b9f176e
commit fcb6923c92
3 changed files with 24 additions and 0 deletions

View File

@@ -37,4 +37,8 @@ class ApplicationController < ActionController::Base
format.any { head status }
end
end
def after_sign_in_path_for(user)
session[:user_return_to] || root_path
end
end

View File

@@ -108,6 +108,7 @@ class Rs::OauthController < ApplicationController
def require_signed_in_with_username
unless user_signed_in?
username, org = params[:useraddress].split("@")
session[:user_return_to] = request.url
redirect_to new_user_session_path(cn: username, ou: org)
end
end