mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: redirect from oauth2 authorization page (#12241)
At the moment it just says "you are not authorized", but we want to automatically redirect to the login page.
This commit is contained in:
@@ -25,7 +25,8 @@ export const LoginPage: FC = () => {
|
||||
// If the redirect is going to a workspace application, and we
|
||||
// are missing authentication, then we need to change the href location
|
||||
// to trigger a HTTP request. This allows the BE to generate the auth
|
||||
// cookie required.
|
||||
// cookie required. Similarly for the OAuth2 exchange as the authorization
|
||||
// page is served by the backend.
|
||||
// If no redirect is present, then ignore this branched logic.
|
||||
if (redirectTo !== "" && redirectTo !== "/") {
|
||||
try {
|
||||
@@ -39,8 +40,8 @@ export const LoginPage: FC = () => {
|
||||
} catch {
|
||||
// Do nothing
|
||||
}
|
||||
// Path based apps.
|
||||
if (redirectTo.includes("/apps/")) {
|
||||
// Path based apps and OAuth2.
|
||||
if (redirectTo.includes("/apps/") || redirectTo.includes("/oauth2/")) {
|
||||
window.location.href = redirectTo;
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user