Compare commits

...

7 Commits

Author SHA1 Message Date
7481b229a4 feat: show domain field for MinIO storage provider 2024-02-14 13:54:17 +08:00
39e485ae82 Fix SigninTable issue 2024-02-14 12:20:03 +08:00
764c64e67c Fix SigninTable CSS 2024-02-14 12:10:30 +08:00
e755a7331d Fix renderLink() 2024-02-14 09:45:21 +08:00
6d9d595f86 fix: Revert "fix: fix display bug in SigninTable" (#2700)
This reverts commit d52058d2ae.
2024-02-14 09:44:42 +08:00
d52058d2ae fix: fix display bug in SigninTable (#2698)
* fix: fix display bug in SigninTable

* fix: fix code bug

* feat: improve code format

* feat: improve code format
2024-02-14 09:26:51 +08:00
bcfbfc6947 Support "signinUrl" in forget page 2024-02-14 02:36:52 +08:00
6 changed files with 23 additions and 16 deletions

View File

@ -223,7 +223,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
Visible: true,
Label: "\n<style>\n .login-logo-box {\n }\n<style>\n",
Placeholder: "",
Rule: "none",
Rule: "None",
}
application.SigninItems = append(application.SigninItems, signinItem)
signinItem = &SigninItem{

View File

@ -876,7 +876,7 @@ class ProviderEditPage extends React.Component {
</Col>
</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"}} >
<Col style={{marginTop: "5px"}} span={2}>
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :

View File

@ -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";
@ -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://")) {
@ -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();
}
@ -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";
@ -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) {

View File

@ -47,6 +47,7 @@ class ForgetPage extends React.Component {
this.form = React.createRef();
}
componentDidMount() {
if (this.getApplicationObj() === undefined) {
if (this.state.applicationName !== undefined) {
@ -153,7 +154,12 @@ class ForgetPage extends React.Component {
values.userOwner = this.getApplicationObj()?.organizationObj.name;
UserBackend.setPassword(values.userOwner, values.username, "", values?.newPassword, this.state.code).then(res => {
if (res.status === "ok") {
Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history);
const linkInStorage = sessionStorage.getItem("signinUrl");
if (linkInStorage !== null && linkInStorage !== "") {
Setting.goToLink(linkInStorage);
} else {
Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history);
}
} else {
Setting.showMessage("error", res.msg);
}

View File

@ -655,7 +655,7 @@ class LoginPage extends React.Component {
);
} else if (signinItem.name === "Providers") {
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";
}
@ -782,7 +782,9 @@ class LoginPage extends React.Component {
:
</div>
<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>
);
}

View File

@ -195,7 +195,7 @@ class SigninTable extends React.Component {
/>
</div>
} 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);
}} />
</Popover>
@ -229,7 +229,7 @@ class SigninTable extends React.Component {
width: "155px",
render: (text, record, index) => {
let options = [];
if (record.name === "ThirdParty") {
if (record.name === "Providers") {
options = [
{id: "big", name: i18next.t("application:Big icon")},
{id: "small", name: i18next.t("application:Small icon")},