- Merge client update into test-beta
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,29 +1,31 @@
|
||||
.login-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 2rem;
|
||||
form {
|
||||
width: 75vw;
|
||||
max-width: 20rem;
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 2rem;
|
||||
|
||||
form {
|
||||
width: 75vw;
|
||||
max-width: 20rem;
|
||||
}
|
||||
|
||||
.login-logo-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
//Required as it is position inside form.
|
||||
.login-btn {
|
||||
margin: 1.5rem 0rem;
|
||||
position: relative;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
.login-logo-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
//Required as it is position inside form.
|
||||
.login-btn {
|
||||
margin: 1.5rem 0rem;
|
||||
position: relative;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
@@ -1,92 +1,90 @@
|
||||
import { Button, Form, Input, Result, Typography } from "antd";
|
||||
import {Button, Form, Input, Result, Typography} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import ImEXOnlineLogo from "../../assets/logo192.png";
|
||||
import {
|
||||
sendPasswordReset,
|
||||
sendPasswordResetAgain,
|
||||
} from "../../redux/user/user.actions";
|
||||
import { selectPasswordReset } from "../../redux/user/user.selectors";
|
||||
import {sendPasswordReset, sendPasswordResetAgain,} from "../../redux/user/user.actions";
|
||||
import {selectPasswordReset} from "../../redux/user/user.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import "./user-request-pw-reset.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
passwordReset: selectPasswordReset,
|
||||
passwordReset: selectPasswordReset,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
sendPasswordReset: (email) => dispatch(sendPasswordReset(email)),
|
||||
sendPasswordResetAgain: (email) => dispatch(sendPasswordResetAgain(email)),
|
||||
sendPasswordReset: (email) => dispatch(sendPasswordReset(email)),
|
||||
sendPasswordResetAgain: (email) => dispatch(sendPasswordResetAgain(email)),
|
||||
});
|
||||
|
||||
export function UserRequestResetPw({
|
||||
passwordReset,
|
||||
sendPasswordReset,
|
||||
sendPasswordResetAgain,
|
||||
}) {
|
||||
const handleFinish = (values) => {
|
||||
try {
|
||||
sendPasswordReset(values.email);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
passwordReset,
|
||||
sendPasswordReset,
|
||||
sendPasswordResetAgain,
|
||||
}) {
|
||||
const handleFinish = (values) => {
|
||||
try {
|
||||
sendPasswordReset(values.email);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const {t} = useTranslation();
|
||||
if (passwordReset.success)
|
||||
return (
|
||||
<Result
|
||||
status="success"
|
||||
title={t("general.labels.passwordresetsuccess")}
|
||||
subTitle={t("general.labels.passwordresetsuccess_sub")}
|
||||
extra={[
|
||||
<Button
|
||||
key="send-again"
|
||||
onClick={() => sendPasswordResetAgain(passwordReset.email)}
|
||||
loading={passwordReset.loading}
|
||||
>
|
||||
{t("general.labels.sendagain")}
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
const { t } = useTranslation();
|
||||
if (passwordReset.success)
|
||||
return (
|
||||
<Result
|
||||
status="success"
|
||||
title={t("general.labels.passwordresetsuccess")}
|
||||
subTitle={t("general.labels.passwordresetsuccess_sub")}
|
||||
extra={[
|
||||
<Button
|
||||
key="send-again"
|
||||
onClick={() => sendPasswordResetAgain(passwordReset.email)}
|
||||
loading={passwordReset.loading}
|
||||
>
|
||||
{t("general.labels.sendagain")}
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
<div className="login-container">
|
||||
<div className="login-logo-container">
|
||||
<img src={ImEXOnlineLogo} height="100" width="100" alt="Rome Online"/>
|
||||
<Typography.Title>{t("titles.app")}</Typography.Title>
|
||||
</div>
|
||||
<Typography.Title level={3}>{t("titles.resetpassword")}</Typography.Title>
|
||||
|
||||
<Form layout="vertical" size="large" onFinish={handleFinish}>
|
||||
<Form.Item
|
||||
label={t("general.labels.email")}
|
||||
name="email"
|
||||
rules={[
|
||||
{
|
||||
type: "email",
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
{passwordReset.error ? (
|
||||
<AlertComponent message={passwordReset.error} type="warning"/>
|
||||
) : null}
|
||||
<Button
|
||||
className="login-btn"
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
loading={passwordReset.loading}
|
||||
>
|
||||
{t("general.actions.submit")}
|
||||
</Button>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="login-container">
|
||||
<div className="login-logo-container">
|
||||
<img src={ImEXOnlineLogo} height="100" width="100" alt="Rome Online" />
|
||||
<Typography.Title>{t("titles.app")}</Typography.Title>
|
||||
</div>
|
||||
<Typography.Title level={3}>{t("titles.resetpassword")}</Typography.Title>
|
||||
|
||||
<Form layout="vertical" size="large" onFinish={handleFinish}>
|
||||
<Form.Item
|
||||
label={t("general.labels.email")}
|
||||
name="email"
|
||||
rules={[
|
||||
{
|
||||
type: "email",
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{passwordReset.error ? (
|
||||
<AlertComponent message={passwordReset.error} type="warning" />
|
||||
) : null}
|
||||
<Button
|
||||
className="login-btn"
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
loading={passwordReset.loading}
|
||||
>
|
||||
{t("general.actions.submit")}
|
||||
</Button>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(UserRequestResetPw);
|
||||
|
||||
Reference in New Issue
Block a user