2022-02-13 23:39:27 +08:00
|
|
|
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
2021-06-02 13:39:01 +08:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
import React from "react";
|
2022-03-15 12:54:57 +08:00
|
|
|
import {Button, Col, Form, Input, Row, Select, Steps} from "antd";
|
2021-06-02 13:39:01 +08:00
|
|
|
import * as AuthBackend from "./AuthBackend";
|
|
|
|
import * as ApplicationBackend from "../backend/ApplicationBackend";
|
|
|
|
import * as Util from "./Util";
|
|
|
|
import * as Setting from "../Setting";
|
|
|
|
import i18next from "i18next";
|
2022-01-07 20:34:27 +08:00
|
|
|
import {CountDownInput} from "../common/CountDownInput";
|
2021-06-02 13:39:01 +08:00
|
|
|
import * as UserBackend from "../backend/UserBackend";
|
2021-11-06 22:04:20 +08:00
|
|
|
import {CheckCircleOutlined, KeyOutlined, LockOutlined, SolutionOutlined, UserOutlined} from "@ant-design/icons";
|
|
|
|
import CustomGithubCorner from "../CustomGithubCorner";
|
2022-11-13 05:16:49 +01:00
|
|
|
import {withRouter} from "react-router-dom";
|
2021-06-02 13:39:01 +08:00
|
|
|
|
2022-07-10 15:45:55 +08:00
|
|
|
const {Step} = Steps;
|
|
|
|
const {Option} = Select;
|
2021-06-02 13:39:01 +08:00
|
|
|
|
|
|
|
class ForgetPage extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
classes: props,
|
|
|
|
account: props.account,
|
|
|
|
applicationName:
|
|
|
|
props.applicationName !== undefined
|
2022-07-10 15:45:55 +08:00
|
|
|
? props.applicationName
|
|
|
|
: props.match === undefined
|
2021-06-02 13:39:01 +08:00
|
|
|
? null
|
|
|
|
: props.match.params.applicationName,
|
|
|
|
application: null,
|
|
|
|
msg: null,
|
|
|
|
userId: "",
|
|
|
|
username: "",
|
2022-03-15 12:54:57 +08:00
|
|
|
name: "",
|
2021-06-02 13:39:01 +08:00
|
|
|
email: "",
|
2021-06-07 19:12:51 +08:00
|
|
|
isFixed: false,
|
|
|
|
fixedContent: "",
|
2021-06-02 13:39:01 +08:00
|
|
|
token: "",
|
|
|
|
phone: "",
|
|
|
|
emailCode: "",
|
|
|
|
phoneCode: "",
|
2021-11-28 11:09:37 +08:00
|
|
|
verifyType: null, // "email" or "phone"
|
2021-06-02 13:39:01 +08:00
|
|
|
current: 0,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
UNSAFE_componentWillMount() {
|
|
|
|
if (this.state.applicationName !== undefined) {
|
|
|
|
this.getApplication();
|
|
|
|
} else {
|
|
|
|
Util.showMessage(
|
2022-07-10 15:45:55 +08:00
|
|
|
"error",
|
2022-08-07 00:17:27 +08:00
|
|
|
i18next.t("forget:Unknown forget type: ") + this.state.type
|
2021-06-02 13:39:01 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getApplication() {
|
|
|
|
if (this.state.applicationName === null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApplicationBackend.getApplication("admin", this.state.applicationName).then(
|
2022-07-10 15:45:55 +08:00
|
|
|
(application) => {
|
|
|
|
this.setState({
|
|
|
|
application: application,
|
|
|
|
});
|
2022-08-07 00:17:27 +08:00
|
|
|
}
|
2021-06-02 13:39:01 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
getApplicationObj() {
|
|
|
|
if (this.props.application !== undefined) {
|
|
|
|
return this.props.application;
|
|
|
|
} else {
|
|
|
|
return this.state.application;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-07 19:12:51 +08:00
|
|
|
onFormFinish(name, info, forms) {
|
2022-07-10 15:45:55 +08:00
|
|
|
switch (name) {
|
|
|
|
case "step1":
|
|
|
|
const username = forms.step1.getFieldValue("username");
|
|
|
|
AuthBackend.getEmailAndPhone({
|
|
|
|
application: forms.step1.getFieldValue("application"),
|
|
|
|
organization: forms.step1.getFieldValue("organization"),
|
2022-08-06 23:54:56 +08:00
|
|
|
username: username,
|
2022-07-10 15:45:55 +08:00
|
|
|
}).then((res) => {
|
|
|
|
if (res.status === "ok") {
|
|
|
|
const phone = res.data.phone;
|
|
|
|
const email = res.data.email;
|
|
|
|
this.setState({phone: phone, email: email, username: res.data.name, name: res.data.name});
|
2021-11-28 11:09:37 +08:00
|
|
|
|
2022-07-10 15:45:55 +08:00
|
|
|
if (phone !== "" && email === "") {
|
|
|
|
this.setState({
|
|
|
|
verifyType: "phone",
|
|
|
|
});
|
|
|
|
} else if (phone === "" && email !== "") {
|
|
|
|
this.setState({
|
|
|
|
verifyType: "email",
|
|
|
|
});
|
|
|
|
}
|
2021-11-28 11:09:37 +08:00
|
|
|
|
2022-07-10 15:45:55 +08:00
|
|
|
switch (res.data2) {
|
|
|
|
case "email":
|
|
|
|
this.setState({isFixed: true, fixedContent: email, verifyType: "email"});
|
|
|
|
break;
|
|
|
|
case "phone":
|
|
|
|
this.setState({isFixed: true, fixedContent: phone, verifyType: "phone"});
|
|
|
|
break;
|
2021-07-25 11:10:45 +08:00
|
|
|
default:
|
2022-07-10 15:45:55 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (this.state.isFixed) {
|
|
|
|
forms.step2.setFieldsValue({email: this.state.fixedContent});
|
|
|
|
this.setState({username: this.state.fixedContent});
|
|
|
|
}
|
|
|
|
this.setState({current: 1});
|
|
|
|
} else {
|
|
|
|
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "step2":
|
|
|
|
const oAuthParams = Util.getOAuthGetParameters();
|
|
|
|
if (this.state.verifyType === "email") {
|
|
|
|
this.setState({username: this.state.email});
|
|
|
|
} else if (this.state.verifyType === "phone") {
|
|
|
|
this.setState({username: this.state.phone});
|
2021-06-02 13:39:01 +08:00
|
|
|
}
|
2022-07-10 15:45:55 +08:00
|
|
|
AuthBackend.login({
|
|
|
|
application: forms.step2.getFieldValue("application"),
|
|
|
|
organization: forms.step2.getFieldValue("organization"),
|
|
|
|
username: this.state.username,
|
|
|
|
name: this.state.name,
|
|
|
|
code: forms.step2.getFieldValue("emailCode"),
|
|
|
|
phonePrefix: this.state.application?.organizationObj.phonePrefix,
|
2022-08-06 23:54:56 +08:00
|
|
|
type: "login",
|
2022-07-10 15:45:55 +08:00
|
|
|
}, oAuthParams).then(res => {
|
|
|
|
if (res.status === "ok") {
|
|
|
|
this.setState({current: 2, userId: res.data, username: res.data.split("/")[1]});
|
|
|
|
} else {
|
|
|
|
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2021-06-02 13:39:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
onFinish(values) {
|
|
|
|
values.username = this.state.username;
|
2022-07-10 15:45:55 +08:00
|
|
|
values.userOwner = this.state.application?.organizationObj.name;
|
2021-06-02 13:39:01 +08:00
|
|
|
UserBackend.setPassword(values.userOwner, values.username, "", values?.newPassword).then(res => {
|
2022-07-10 15:45:55 +08:00
|
|
|
if (res.status === "ok") {
|
2022-11-13 05:16:49 +01:00
|
|
|
Setting.redirectToLoginPage(this.state.application, this.props.history);
|
2022-07-10 15:45:55 +08:00
|
|
|
} else {
|
|
|
|
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
|
|
|
|
}
|
|
|
|
});
|
2021-06-02 13:39:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
onFinishFailed(values, errorFields) {}
|
|
|
|
|
2021-11-28 11:09:37 +08:00
|
|
|
renderOptions() {
|
2022-08-08 23:35:24 +08:00
|
|
|
const options = [];
|
2021-11-28 11:09:37 +08:00
|
|
|
|
|
|
|
if (this.state.phone !== "") {
|
|
|
|
options.push(
|
|
|
|
<Option key={"phone"} value={"phone"}>
|
2022-03-15 12:54:57 +08:00
|
|
|
{this.state.phone}
|
2022-08-07 00:17:27 +08:00
|
|
|
</Option>
|
2021-11-28 11:09:37 +08:00
|
|
|
);
|
2021-12-24 14:09:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.state.email !== "") {
|
2021-11-28 11:09:37 +08:00
|
|
|
options.push(
|
|
|
|
<Option key={"email"} value={"email"}>
|
2022-03-15 12:54:57 +08:00
|
|
|
{this.state.email}
|
2022-08-07 00:17:27 +08:00
|
|
|
</Option>
|
2021-11-28 11:09:37 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2021-06-02 13:39:01 +08:00
|
|
|
renderForm(application) {
|
|
|
|
return (
|
2022-07-10 15:45:55 +08:00
|
|
|
<Form.Provider onFormFinish={(name, {info, forms}) => {
|
|
|
|
this.onFormFinish(name, info, forms);
|
|
|
|
}}>
|
|
|
|
{/* STEP 1: input username -> get email & phone */}
|
|
|
|
<Form
|
|
|
|
hidden={this.state.current !== 0}
|
|
|
|
ref={this.form}
|
|
|
|
name="step1"
|
2022-08-13 00:04:18 +08:00
|
|
|
// eslint-disable-next-line no-console
|
2022-07-10 15:45:55 +08:00
|
|
|
onFinishFailed={(errorInfo) => console.log(errorInfo)}
|
|
|
|
initialValues={{
|
|
|
|
application: application.name,
|
|
|
|
organization: application.organization,
|
|
|
|
}}
|
|
|
|
style={{width: "300px"}}
|
|
|
|
size="large"
|
|
|
|
>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="application"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your application!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="organization"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your organization!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
name="username"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your username!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
whitespace: true,
|
|
|
|
},
|
|
|
|
]}
|
2021-06-02 13:39:01 +08:00
|
|
|
>
|
2022-07-10 15:45:55 +08:00
|
|
|
<Input
|
|
|
|
onChange={(e) => {
|
|
|
|
this.setState({
|
|
|
|
username: e.target.value,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
prefix={<UserOutlined />}
|
|
|
|
placeholder={i18next.t("login:username, Email or phone")}
|
2021-06-02 13:39:01 +08:00
|
|
|
/>
|
2022-07-10 15:45:55 +08:00
|
|
|
</Form.Item>
|
|
|
|
<br />
|
|
|
|
<Form.Item>
|
|
|
|
<Button block type="primary" htmlType="submit">
|
|
|
|
{i18next.t("forget:Next Step")}
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
{/* STEP 2: verify email or phone */}
|
|
|
|
<Form
|
|
|
|
hidden={this.state.current !== 1}
|
|
|
|
ref={this.form}
|
|
|
|
name="step2"
|
|
|
|
onFinishFailed={(errorInfo) =>
|
|
|
|
this.onFinishFailed(
|
|
|
|
errorInfo.values,
|
|
|
|
errorInfo.errorFields,
|
2022-08-07 00:17:27 +08:00
|
|
|
errorInfo.outOfDate
|
2022-07-10 15:45:55 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
initialValues={{
|
|
|
|
application: application.name,
|
|
|
|
organization: application.organization,
|
|
|
|
}}
|
|
|
|
style={{width: "300px"}}
|
|
|
|
size="large"
|
|
|
|
>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="application"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your application!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="organization"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your organization!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
name="email" // use email instead of email/phone to adapt to RequestForm in account.go
|
|
|
|
validateFirst
|
|
|
|
hasFeedback
|
|
|
|
>
|
|
|
|
{
|
|
|
|
this.state.isFixed ? <Input disabled /> :
|
|
|
|
<Select
|
|
|
|
key={this.state.verifyType}
|
|
|
|
virtual={false} style={{textAlign: "left"}}
|
|
|
|
defaultValue={this.state.verifyType}
|
|
|
|
disabled={this.state.username === ""}
|
|
|
|
placeholder={i18next.t("forget:Choose email or phone")}
|
|
|
|
onChange={(value) => {
|
2021-06-02 13:39:01 +08:00
|
|
|
this.setState({
|
2022-07-10 15:45:55 +08:00
|
|
|
verifyType: value,
|
2021-06-02 13:39:01 +08:00
|
|
|
});
|
|
|
|
}}
|
2022-07-10 15:45:55 +08:00
|
|
|
>
|
2021-06-02 13:39:01 +08:00
|
|
|
{
|
2022-07-10 15:45:55 +08:00
|
|
|
this.renderOptions()
|
|
|
|
}
|
|
|
|
</Select>
|
|
|
|
}
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item
|
|
|
|
name="emailCode" // use emailCode instead of email/phoneCode to adapt to RequestForm in account.go
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"code:Please input your verification code!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
{this.state.verifyType === "email" ? (
|
|
|
|
<CountDownInput
|
|
|
|
disabled={this.state.username === "" || this.state.verifyType === ""}
|
|
|
|
onButtonClickArgs={[this.state.email, "email", Setting.getApplicationName(this.state.application), this.state.name]}
|
2022-08-23 23:30:45 +08:00
|
|
|
application={application}
|
2022-07-10 15:45:55 +08:00
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<CountDownInput
|
|
|
|
disabled={this.state.username === "" || this.state.verifyType === ""}
|
|
|
|
onButtonClickArgs={[this.state.phone, "phone", Setting.getApplicationName(this.state.application), this.state.name]}
|
2022-08-23 23:30:45 +08:00
|
|
|
application={application}
|
2022-07-10 15:45:55 +08:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</Form.Item>
|
|
|
|
<br />
|
|
|
|
<Form.Item>
|
|
|
|
<Button
|
|
|
|
block
|
|
|
|
type="primary"
|
|
|
|
htmlType="submit"
|
2021-06-02 13:39:01 +08:00
|
|
|
>
|
2022-07-10 15:45:55 +08:00
|
|
|
{i18next.t("forget:Next Step")}
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
2021-06-02 13:39:01 +08:00
|
|
|
|
2022-07-10 15:45:55 +08:00
|
|
|
{/* STEP 3 */}
|
|
|
|
<Form
|
|
|
|
hidden={this.state.current !== 2}
|
|
|
|
ref={this.form}
|
|
|
|
name="step3"
|
|
|
|
onFinish={(values) => this.onFinish(values)}
|
|
|
|
onFinishFailed={(errorInfo) =>
|
|
|
|
this.onFinishFailed(
|
|
|
|
errorInfo.values,
|
|
|
|
errorInfo.errorFields,
|
2022-08-07 00:17:27 +08:00
|
|
|
errorInfo.outOfDate
|
2022-07-10 15:45:55 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
initialValues={{
|
|
|
|
application: application.name,
|
|
|
|
organization: application.organization,
|
|
|
|
}}
|
|
|
|
style={{width: "300px"}}
|
|
|
|
size="large"
|
|
|
|
>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="application"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your application!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
style={{height: 0, visibility: "hidden"}}
|
|
|
|
name="organization"
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your organization!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
<Form.Item
|
|
|
|
name="newPassword"
|
|
|
|
hidden={this.state.current !== 2}
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please input your password!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
hasFeedback
|
2021-06-02 13:39:01 +08:00
|
|
|
>
|
2022-07-10 15:45:55 +08:00
|
|
|
<Input.Password
|
|
|
|
disabled={this.state.userId === ""}
|
|
|
|
prefix={<LockOutlined />}
|
|
|
|
placeholder={i18next.t("forget:Password")}
|
2021-06-02 13:39:01 +08:00
|
|
|
/>
|
2022-07-10 15:45:55 +08:00
|
|
|
</Form.Item>
|
|
|
|
<Form.Item
|
|
|
|
name="confirm"
|
|
|
|
dependencies={["newPassword"]}
|
|
|
|
hasFeedback
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Please confirm your password!"
|
2022-07-10 15:45:55 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
({getFieldValue}) => ({
|
|
|
|
validator(rule, value) {
|
|
|
|
if (!value || getFieldValue("newPassword") === value) {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
return Promise.reject(
|
|
|
|
i18next.t(
|
2022-08-07 00:17:27 +08:00
|
|
|
"forget:Your confirmed password is inconsistent with the password!"
|
|
|
|
)
|
2022-07-10 15:45:55 +08:00
|
|
|
);
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
<Input.Password
|
|
|
|
disabled={this.state.userId === ""}
|
|
|
|
prefix={<CheckCircleOutlined />}
|
|
|
|
placeholder={i18next.t("forget:Confirm")}
|
2021-06-02 13:39:01 +08:00
|
|
|
/>
|
2022-07-10 15:45:55 +08:00
|
|
|
</Form.Item>
|
|
|
|
<br />
|
|
|
|
<Form.Item hidden={this.state.current !== 2}>
|
2022-08-07 00:06:20 +08:00
|
|
|
<Button block type="primary" htmlType="submit" disabled={this.state.userId === ""}>
|
2022-07-10 15:45:55 +08:00
|
|
|
{i18next.t("forget:Change Password")}
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form>
|
|
|
|
</Form.Provider>
|
2021-06-02 13:39:01 +08:00
|
|
|
);
|
2022-07-10 15:45:55 +08:00
|
|
|
}
|
2021-06-02 13:39:01 +08:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const application = this.getApplicationObj();
|
|
|
|
if (application === null) {
|
|
|
|
return Util.renderMessageLarge(this, this.state.msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-10-22 21:43:41 +08:00
|
|
|
<div className="loginBackground" style={{backgroundImage: Setting.inIframe() || Setting.isMobile() ? null : `url(${application.formBackgroundUrl})`}}>
|
|
|
|
<CustomGithubCorner />
|
2022-11-05 15:54:22 +01:00
|
|
|
<div className="login-content forget-content" style={{padding: Setting.isMobile() ? "0" : null, boxShadow: Setting.isMobile() ? "none" : null}}>
|
2021-06-02 13:39:01 +08:00
|
|
|
<Row>
|
2022-10-22 21:43:41 +08:00
|
|
|
<Col span={24} style={{justifyContent: "center"}}>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<div style={{marginTop: "80px", marginBottom: "10px", textAlign: "center"}}>
|
|
|
|
{
|
|
|
|
Setting.renderHelmet(application)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
Setting.renderLogo(application)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<div style={{textAlign: "center", fontSize: "28px"}}>
|
|
|
|
{i18next.t("forget:Retrieve password")}
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={24}>
|
|
|
|
<Steps
|
|
|
|
current={this.state.current}
|
|
|
|
style={{
|
|
|
|
width: "90%",
|
|
|
|
maxWidth: "500px",
|
|
|
|
margin: "auto",
|
|
|
|
marginTop: "80px",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Step
|
|
|
|
title={i18next.t("forget:Account")}
|
|
|
|
icon={<UserOutlined />}
|
|
|
|
/>
|
|
|
|
<Step
|
|
|
|
title={i18next.t("forget:Verify")}
|
|
|
|
icon={<SolutionOutlined />}
|
|
|
|
/>
|
|
|
|
<Step
|
|
|
|
title={i18next.t("forget:Reset")}
|
|
|
|
icon={<KeyOutlined />}
|
|
|
|
/>
|
|
|
|
</Steps>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2021-11-28 14:11:09 +08:00
|
|
|
</Col>
|
2022-10-22 21:43:41 +08:00
|
|
|
<Col span={24} style={{display: "flex", justifyContent: "center"}}>
|
|
|
|
<div style={{marginTop: "10px", textAlign: "center"}}>
|
|
|
|
{this.renderForm(application)}
|
2021-11-28 14:11:09 +08:00
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2022-10-22 21:43:41 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-06-02 13:39:01 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-13 05:16:49 +01:00
|
|
|
export default withRouter(ForgetPage);
|