diff --git a/src/features/AuthServiceApp/components/ChangePassword/hooks.tsx b/src/features/AuthServiceApp/components/ChangePassword/hooks.tsx index a2c036c1..cfcca3f3 100644 --- a/src/features/AuthServiceApp/components/ChangePassword/hooks.tsx +++ b/src/features/AuthServiceApp/components/ChangePassword/hooks.tsx @@ -12,6 +12,7 @@ export const useChangePasswordForm = () => { const [isFetching, setIsFetching] = useState(false) const [password, setPassword] = useState('') const [confirmPassword, setConfirmPassword] = useState('') + const [disabled, setDisabled] = useState(true) const { checkPassword, @@ -39,6 +40,7 @@ export const useChangePasswordForm = () => { if (!checkPassword(value)) { setError('check_password') } else { + setDisabled(false) setError('') } setPassword(value) @@ -66,6 +68,7 @@ export const useChangePasswordForm = () => { return { confirmPassword, + disabled, error, handleSubmit, isFetching, diff --git a/src/features/AuthServiceApp/components/ChangePassword/index.tsx b/src/features/AuthServiceApp/components/ChangePassword/index.tsx index c0d1d155..68fba561 100644 --- a/src/features/AuthServiceApp/components/ChangePassword/index.tsx +++ b/src/features/AuthServiceApp/components/ChangePassword/index.tsx @@ -18,6 +18,7 @@ import { const ChangePassword = () => { const { confirmPassword, + disabled, error, handleSubmit, isFetching, @@ -53,13 +54,13 @@ const ChangePassword = () => { placeholderLexic='password_repeat' value={confirmPassword} onChange={onConfirmPasswordChange} + disabled={disabled} /> - - + { isFetching diff --git a/src/features/AuthServiceApp/components/Input/index.tsx b/src/features/AuthServiceApp/components/Input/index.tsx index 2ac62d89..4e09bc8b 100644 --- a/src/features/AuthServiceApp/components/Input/index.tsx +++ b/src/features/AuthServiceApp/components/Input/index.tsx @@ -12,6 +12,7 @@ type Props = Pick, ( 'autoComplete' | 'autoFocus' | 'className' | + 'disabled' | 'name' | 'onBlur' | 'onChange' | @@ -29,6 +30,7 @@ export const Input = ({ autoComplete, autoFocus, className, + disabled, leftContent, name, onBlur, @@ -49,6 +51,7 @@ export const Input = ({ export const PasswordInput = ({ autoComplete, className, + disabled, leftContent, name, onBlur, @@ -62,6 +63,7 @@ export const PasswordInput = ({ void) => { setIsFetching(false) } - const handleSubmit = () => { - if (isSendMessage && !isFetching) { - closePopup() - } else { + const handleSubmit = async () => { + try { setIsFetching(true) - loginCheckChangePass(email) - .then(() => setIsSendMessage(true)) - .then(() => setIsFetching(false)) - .catch(handleError) + await loginCheckChangePass(email) + setIsFetching(false) + setIsSendMessage(true) + } catch (err) { + handleError(String(err)) } } diff --git a/src/features/AuthServiceApp/components/RecoveryPopup/index.tsx b/src/features/AuthServiceApp/components/RecoveryPopup/index.tsx index 55aaedb5..2cb66413 100644 --- a/src/features/AuthServiceApp/components/RecoveryPopup/index.tsx +++ b/src/features/AuthServiceApp/components/RecoveryPopup/index.tsx @@ -72,10 +72,15 @@ export const RecoveryPopup = (props: Props) => { )} diff --git a/src/features/AuthServiceApp/config/lexics.tsx b/src/features/AuthServiceApp/config/lexics.tsx index e29b9ba6..15698397 100644 --- a/src/features/AuthServiceApp/config/lexics.tsx +++ b/src/features/AuthServiceApp/config/lexics.tsx @@ -26,7 +26,7 @@ export const lexics = { login: 13404, password_new: 15056, password_repeat: 15057, - recovery_email: 16238, + recovery_email: 15833, register: 13328, registration_email: 16239, registration_successful: 12945,