diff --git a/webclient/src/components/ResetPasswordDialog/ResetPasswordDialog.tsx b/webclient/src/components/ResetPasswordDialog/ResetPasswordDialog.tsx
index d0bd8f88..59799f30 100644
--- a/webclient/src/components/ResetPasswordDialog/ResetPasswordDialog.tsx
+++ b/webclient/src/components/ResetPasswordDialog/ResetPasswordDialog.tsx
@@ -27,7 +27,7 @@ const ResetPasswordDialog = ({ classes, handleClose, isOpen, onSubmit }: any) =>
) : null}
-
+
);
diff --git a/webclient/src/containers/Login/Login.tsx b/webclient/src/containers/Login/Login.tsx
index 8db2480b..313a1656 100644
--- a/webclient/src/containers/Login/Login.tsx
+++ b/webclient/src/containers/Login/Login.tsx
@@ -1,5 +1,5 @@
// eslint-disable-next-line
-import React, { useState } from "react";
+import React, {useState} from "react";
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
@@ -13,9 +13,9 @@ import { RequestPasswordResetDialog, ResetPasswordDialog } from 'components';
import { LoginForm } from 'forms';
import { useReduxEffect } from 'hooks';
import { Images } from 'images';
-import { RouteEnum } from 'types';
+import { RouteEnum, StatusEnum } from 'types';
import { ServerSelectors, ServerTypes } from 'store';
-
+import { SessionCommands } from 'websocket';
import './Login.css';
const useStyles = makeStyles(theme => ({
@@ -60,13 +60,18 @@ const Login = ({ state, description }: LoginProps) => {
const isConnected = AuthenticationService.isConnected(state);
const [dialogState, setDialogState] = useState({
- openRequest: false,
- openReset: false
+ passwordResetRequestDialog: false,
+ resetPasswordDialog: false
});
useReduxEffect(() => {
+ closeRequestPasswordResetDialog();
openResetPasswordDialog();
- }, ServerTypes.RESET_PASSWORD, []);
+ }, ServerTypes.RESET_PASSWORD_REQUESTED, []);
+
+ useReduxEffect(() => {
+ closeResetPasswordDialog();
+ }, ServerTypes.RESET_PASSWORD_SUCCESS, []);
const showDescription = () => {
return !isConnected && description?.length;
@@ -82,30 +87,26 @@ const Login = ({ state, description }: LoginProps) => {
} else {
AuthenticationService.resetPasswordRequest({ user, host, port } as any);
}
-
- closeRequestPasswordResetDialog();
};
const handleResetPasswordDialogSubmit = async ({ user, token, newPassword, passwordAgain, host, port }) => {
AuthenticationService.resetPassword({ user, token, newPassword, host, port } as any);
-
- closeResetPasswordDialog();
};
const closeRequestPasswordResetDialog = () => {
- setDialogState(s => ({ ...s, openRequest: false }));
+ setDialogState(s => ({ ...s, passwordResetRequestDialog: false }));
}
const openRequestPasswordResetDialog = () => {
- setDialogState(s => ({ ...s, openRequest: true }));
+ setDialogState(s => ({ ...s, passwordResetRequestDialog: true }));
}
const closeResetPasswordDialog = () => {
- setDialogState(s => ({ ...s, openReset: false }));
+ setDialogState(s => ({ ...s, resetPasswordDialog: false }));
}
const openResetPasswordDialog = () => {
- setDialogState(s => ({ ...s, openReset: true }));
+ setDialogState(s => ({ ...s, resetPasswordDialog: true }));
}
return (
@@ -184,13 +185,13 @@ const Login = ({ state, description }: LoginProps) => {
diff --git a/webclient/src/forms/RegisterForm/RegisterForm.tsx b/webclient/src/forms/RegisterForm/RegisterForm.tsx
index 7e8b1163..7e743d20 100644
--- a/webclient/src/forms/RegisterForm/RegisterForm.tsx
+++ b/webclient/src/forms/RegisterForm/RegisterForm.tsx
@@ -1,66 +1,66 @@
-// eslint-disable-next-line
+// eslint-disable-next-line
import React, { Component } from 'react';
-import { connect } from 'react-redux';
-import { Form, Field, reduxForm, change } from 'redux-form'
-
-import Button from '@material-ui/core/Button';
-
-import { InputField, KnownHosts } from 'components';
-import { FormKey } from 'types';
-
-import './RegisterForm.css';
-
-const RegisterForm = (props) => {
- const { dispatch, handleSubmit } = props;
-
- const onHostChange = ({ host, port }) => {
- dispatch(change(FormKey.REGISTER, 'host', host));
- dispatch(change(FormKey.REGISTER, 'port', port));
- }
- return (
-
- );
-};
-
-const propsMap = {
- form: FormKey.REGISTER,
-};
-
-const mapStateToProps = () => ({
- initialValues: {
-
- }
-});
-
-export default connect(mapStateToProps)(reduxForm(propsMap)(RegisterForm));
+import { connect } from 'react-redux';
+import { Form, Field, reduxForm, change } from 'redux-form'
+
+import Button from '@material-ui/core/Button';
+
+import { InputField, KnownHosts } from 'components';
+import { FormKey } from 'types';
+
+import './RegisterForm.css';
+
+const RegisterForm = (props) => {
+ const { dispatch, handleSubmit } = props;
+
+ const onHostChange = ({ host, port }) => {
+ dispatch(change(FormKey.REGISTER, 'host', host));
+ dispatch(change(FormKey.REGISTER, 'port', port));
+ }
+ return (
+
+ );
+};
+
+const propsMap = {
+ form: FormKey.REGISTER,
+};
+
+const mapStateToProps = () => ({
+ initialValues: {
+
+ }
+});
+
+export default connect(mapStateToProps)(reduxForm(propsMap)(RegisterForm));
diff --git a/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.css b/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.css
index 3087a3bf..bfc66182 100644
--- a/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.css
+++ b/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.css
@@ -2,6 +2,14 @@
width: 100%;
}
+.RequestPasswordResetForm-MFA-Message {
+ margin-top: -20px;
+}
+
+.RequestPasswordResetForm-Error {
+ margin-bottom: 10px;
+}
+
.RequestPasswordResetForm-item {
margin-bottom: 20px;
}
diff --git a/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.tsx b/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.tsx
index 0e7386ef..4be854e8 100644
--- a/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.tsx
+++ b/webclient/src/forms/RequestPasswordResetForm/RequestPasswordResetForm.tsx
@@ -1,5 +1,5 @@
// eslint-disable-next-line
-import React from "react";
+import React, { useState } from "react";
import { connect } from 'react-redux';
import { Form, Field, reduxForm, change } from 'redux-form'
@@ -9,21 +9,47 @@ import { InputField, KnownHosts } from 'components';
import { FormKey } from 'types';
import './RequestPasswordResetForm.css';
+import { useReduxEffect } from 'hooks';
+import { ServerTypes } from 'store';
const RequestPasswordResetForm = (props) => {
const { dispatch, handleSubmit } = props;
+ const [errorMessage, setErrorMessage] = useState(false);
+ const [isMFA, setIsMFA] = useState(false);
const onHostChange = ({ host, port }) => {
dispatch(change(FormKey.RESET_PASSWORD_REQUEST, 'host', host));
dispatch(change(FormKey.RESET_PASSWORD_REQUEST, 'port', port));
}
+ useReduxEffect(() => {
+ setErrorMessage(true);
+ }, ServerTypes.RESET_PASSWORD_FAILED, []);
+
+ useReduxEffect(() => {
+ setIsMFA(true);
+ }, ServerTypes.RESET_PASSWORD_CHALLENGE, []);
+
+ const onSubmit = (event) => {
+ setErrorMessage(false);
+ handleSubmit(event);
+ }
+
return (
-