mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-22 00:13:49 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
7481b229a4 | |||
39e485ae82 | |||
764c64e67c | |||
e755a7331d | |||
6d9d595f86 | |||
d52058d2ae | |||
bcfbfc6947 |
@ -223,7 +223,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
|||||||
Visible: true,
|
Visible: true,
|
||||||
Label: "\n<style>\n .login-logo-box {\n }\n<style>\n",
|
Label: "\n<style>\n .login-logo-box {\n }\n<style>\n",
|
||||||
Placeholder: "",
|
Placeholder: "",
|
||||||
Rule: "none",
|
Rule: "None",
|
||||||
}
|
}
|
||||||
application.SigninItems = append(application.SigninItems, signinItem)
|
application.SigninItems = append(application.SigninItems, signinItem)
|
||||||
signinItem = &SigninItem{
|
signinItem = &SigninItem{
|
||||||
|
@ -876,7 +876,7 @@ class ProviderEditPage extends React.Component {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
{["Custom HTTP SMS", "MinIO", "Google Cloud Storage", "Qiniu Cloud Kodo", "Synology"].includes(this.state.provider.type) ? null : (
|
{["Custom HTTP SMS", "Google Cloud Storage", "Qiniu Cloud Kodo", "Synology"].includes(this.state.provider.type) ? null : (
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={2}>
|
<Col style={{marginTop: "5px"}} span={2}>
|
||||||
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
|
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
|
||||||
|
@ -1164,7 +1164,7 @@ export function getLoginLink(application) {
|
|||||||
let url;
|
let url;
|
||||||
if (application === null) {
|
if (application === null) {
|
||||||
url = 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");
|
url = window.location.href.replace("/auto-signup/oauth/authorize", "/login/oauth/authorize");
|
||||||
} else if (authConfig.appName === application.name) {
|
} else if (authConfig.appName === application.name) {
|
||||||
url = "/login";
|
url = "/login";
|
||||||
@ -1176,11 +1176,6 @@ export function getLoginLink(application) {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderLoginLink(application, text) {
|
|
||||||
const url = getLoginLink(application);
|
|
||||||
return renderLink(url, text, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function redirectToLoginPage(application, history) {
|
export function redirectToLoginPage(application, history) {
|
||||||
const loginLink = getLoginLink(application);
|
const loginLink = getLoginLink(application);
|
||||||
if (loginLink.startsWith("http://") || loginLink.startsWith("https://")) {
|
if (loginLink.startsWith("http://") || loginLink.startsWith("https://")) {
|
||||||
@ -1205,7 +1200,7 @@ function renderLink(url, text, onClick) {
|
|||||||
);
|
);
|
||||||
} else if (url.startsWith("http")) {
|
} else if (url.startsWith("http")) {
|
||||||
return (
|
return (
|
||||||
<a target="_blank" rel="noopener noreferrer" style={{float: "right"}} href={url} onClick={() => {
|
<a style={{float: "right"}} href={url} onClick={() => {
|
||||||
if (onClick !== null) {
|
if (onClick !== null) {
|
||||||
onClick();
|
onClick();
|
||||||
}
|
}
|
||||||
@ -1220,7 +1215,7 @@ export function renderSignupLink(application, text) {
|
|||||||
let url;
|
let url;
|
||||||
if (application === null) {
|
if (application === null) {
|
||||||
url = 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");
|
url = window.location.href.replace("/login/oauth/authorize", "/auto-signup/oauth/authorize");
|
||||||
} else if (authConfig.appName === application.name) {
|
} else if (authConfig.appName === application.name) {
|
||||||
url = "/signup";
|
url = "/signup";
|
||||||
@ -1253,7 +1248,11 @@ export function renderForgetLink(application, text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderLink(url, text, null);
|
const storeSigninUrl = () => {
|
||||||
|
sessionStorage.setItem("signinUrl", window.location.href);
|
||||||
|
};
|
||||||
|
|
||||||
|
return renderLink(url, text, storeSigninUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderHelmet(application) {
|
export function renderHelmet(application) {
|
||||||
|
@ -47,6 +47,7 @@ class ForgetPage extends React.Component {
|
|||||||
|
|
||||||
this.form = React.createRef();
|
this.form = React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.getApplicationObj() === undefined) {
|
if (this.getApplicationObj() === undefined) {
|
||||||
if (this.state.applicationName !== undefined) {
|
if (this.state.applicationName !== undefined) {
|
||||||
@ -153,7 +154,12 @@ class ForgetPage extends React.Component {
|
|||||||
values.userOwner = this.getApplicationObj()?.organizationObj.name;
|
values.userOwner = this.getApplicationObj()?.organizationObj.name;
|
||||||
UserBackend.setPassword(values.userOwner, values.username, "", values?.newPassword, this.state.code).then(res => {
|
UserBackend.setPassword(values.userOwner, values.username, "", values?.newPassword, this.state.code).then(res => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
|
const linkInStorage = sessionStorage.getItem("signinUrl");
|
||||||
|
if (linkInStorage !== null && linkInStorage !== "") {
|
||||||
|
Setting.goToLink(linkInStorage);
|
||||||
|
} else {
|
||||||
Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history);
|
Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
}
|
}
|
||||||
|
@ -655,7 +655,7 @@ class LoginPage extends React.Component {
|
|||||||
);
|
);
|
||||||
} else if (signinItem.name === "Providers") {
|
} else if (signinItem.name === "Providers") {
|
||||||
const showForm = Setting.isPasswordEnabled(application) || Setting.isCodeSigninEnabled(application) || Setting.isWebAuthnEnabled(application) || Setting.isLdapEnabled(application);
|
const showForm = Setting.isPasswordEnabled(application) || Setting.isCodeSigninEnabled(application) || Setting.isWebAuthnEnabled(application) || Setting.isLdapEnabled(application);
|
||||||
if (signinItem.rule === "None") {
|
if (signinItem.rule === "None" || signinItem.rule === "") {
|
||||||
signinItem.rule = showForm ? "small" : "big";
|
signinItem.rule = showForm ? "small" : "big";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,7 +782,9 @@ class LoginPage extends React.Component {
|
|||||||
:
|
:
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
{application.signinItems.map(signinItem => signinItem.name === "ThirdParty" || signinItem.name === "Footer" ? this.renderFormItem(application, signinItem) : null)}
|
{
|
||||||
|
application?.signinItems.map(signinItem => signinItem.name === "Providers" || signinItem.name === "Signup link" ? this.renderFormItem(application, signinItem) : null)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class SigninTable extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
} title={i18next.t("application:CSS style")} trigger="click">
|
} title={i18next.t("application:CSS style")} trigger="click">
|
||||||
<Input value={text} style={{marginBottom: "10px"}} onChange={e => {
|
<Input value={text} onChange={e => {
|
||||||
this.updateField(table, index, "label", e.target.value);
|
this.updateField(table, index, "label", e.target.value);
|
||||||
}} />
|
}} />
|
||||||
</Popover>
|
</Popover>
|
||||||
@ -229,7 +229,7 @@ class SigninTable extends React.Component {
|
|||||||
width: "155px",
|
width: "155px",
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
let options = [];
|
let options = [];
|
||||||
if (record.name === "ThirdParty") {
|
if (record.name === "Providers") {
|
||||||
options = [
|
options = [
|
||||||
{id: "big", name: i18next.t("application:Big icon")},
|
{id: "big", name: i18next.t("application:Big icon")},
|
||||||
{id: "small", name: i18next.t("application:Small icon")},
|
{id: "small", name: i18next.t("application:Small icon")},
|
||||||
|
Reference in New Issue
Block a user