Skip to content

Commit

Permalink
Fix renderLink()
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Feb 14, 2024
1 parent 6d9d595 commit e755a73
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions web/src/Setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ export function getLoginLink(application) {
let url;
if (application === null) {
url = null;
} else if (!isPasswordEnabled(application) && window.location.pathname.includes("/auto-signup/oauth/authorize")) {
} else if (window.location.pathname.includes("/auto-signup/oauth/authorize")) {
url = window.location.href.replace("/auto-signup/oauth/authorize", "/login/oauth/authorize");
} else if (authConfig.appName === application.name) {
url = "/login";
Expand All @@ -1176,11 +1176,6 @@ export function getLoginLink(application) {
return url;
}

export function renderLoginLink(application, text) {
const url = getLoginLink(application);
return renderLink(url, text, null);
}

export function redirectToLoginPage(application, history) {
const loginLink = getLoginLink(application);
if (loginLink.startsWith("http://") || loginLink.startsWith("https://")) {
Expand All @@ -1205,7 +1200,7 @@ function renderLink(url, text, onClick) {
);
} else if (url.startsWith("http")) {
return (
<a target="_blank" rel="noopener noreferrer" style={{float: "right"}} href={url} onClick={() => {
<a style={{float: "right"}} href={url} onClick={() => {
if (onClick !== null) {
onClick();
}
Expand All @@ -1220,7 +1215,7 @@ export function renderSignupLink(application, text) {
let url;
if (application === null) {
url = null;
} else if (!isPasswordEnabled(application) && window.location.pathname.includes("/login/oauth/authorize")) {
} else if (window.location.pathname.includes("/login/oauth/authorize")) {
url = window.location.href.replace("/login/oauth/authorize", "/auto-signup/oauth/authorize");
} else if (authConfig.appName === application.name) {
url = "/signup";
Expand Down

0 comments on commit e755a73

Please sign in to comment.