Added sagas + pages for password reset. WIP BOD-165
This commit is contained in:
@@ -3,11 +3,14 @@ import { Button, Form, Input, Typography } from "antd";
|
||||
import React from "react";
|
||||
import { useApolloClient } from "react-apollo";
|
||||
import { connect } from "react-redux";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import { Redirect, Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ImEXOnlineLogo from "../../assets/logo240.png";
|
||||
import { UPSERT_USER } from "../../graphql/user.queries";
|
||||
import { emailSignInStart } from "../../redux/user/user.actions";
|
||||
import {
|
||||
emailSignInStart,
|
||||
sendPasswordReset,
|
||||
} from "../../redux/user/user.actions";
|
||||
import {
|
||||
selectCurrentUser,
|
||||
selectSignInError,
|
||||
@@ -24,12 +27,14 @@ const mapStateToProps = createStructuredSelector({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
emailSignInStart: (email, password) =>
|
||||
dispatch(emailSignInStart({ email, password })),
|
||||
sendPasswordReset: (email) => dispatch(sendPasswordReset(email)),
|
||||
});
|
||||
|
||||
export function SignInComponent({
|
||||
emailSignInStart,
|
||||
currentUser,
|
||||
signInError,
|
||||
sendPasswordReset,
|
||||
}) {
|
||||
const apolloClient = useApolloClient();
|
||||
const { t } = useTranslation();
|
||||
@@ -39,6 +44,7 @@ export function SignInComponent({
|
||||
};
|
||||
const [form] = Form.useForm();
|
||||
|
||||
//TODO - may be able to run this only on new user creation.
|
||||
if (currentUser.authorized === true) {
|
||||
apolloClient
|
||||
.mutate({
|
||||
@@ -55,6 +61,7 @@ export function SignInComponent({
|
||||
}
|
||||
|
||||
if (currentUser.authorized === true) return <Redirect to='/manage' />;
|
||||
|
||||
return (
|
||||
<div className='login-container'>
|
||||
<div className='login-logo-container'>
|
||||
@@ -90,6 +97,9 @@ export function SignInComponent({
|
||||
{t("general.actions.login")}
|
||||
</Button>
|
||||
</Form>
|
||||
<Link to={"/resetpassword"}>
|
||||
<Button>{t("general.actions.resetpassword")}</Button>
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user