File tree Expand file tree Collapse file tree
apps/customer_dashboard/src
app/users/forgot_password Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -364,12 +364,18 @@ export default function ForgotPasswordPage() {
364364 placeholder = "Enter new password"
365365 value = { password }
366366 onChange = { ( e ) => {
367- setPassword ( e . target . value ) ;
368- resetError ( ) ;
367+ const value = e . target . value ;
368+ setPassword ( value ) ;
369+ if ( value . length > PASSWORD_MAX_LENGTH ) {
370+ setError (
371+ `Password must be at most ${ PASSWORD_MAX_LENGTH } characters` ,
372+ ) ;
373+ } else {
374+ resetError ( ) ;
375+ }
369376 } }
370377 fullWidth
371378 requiredSymbol
372- maxLength = { PASSWORD_MAX_LENGTH }
373379 helpText = {
374380 error
375381 ? undefined
@@ -392,12 +398,18 @@ export default function ForgotPasswordPage() {
392398 placeholder = "Confirm password"
393399 value = { confirmPassword }
394400 onChange = { ( e ) => {
395- setConfirmPassword ( e . target . value ) ;
396- resetError ( ) ;
401+ const value = e . target . value ;
402+ setConfirmPassword ( value ) ;
403+ if ( value . length > PASSWORD_MAX_LENGTH ) {
404+ setError (
405+ `Password must be at most ${ PASSWORD_MAX_LENGTH } characters` ,
406+ ) ;
407+ } else {
408+ resetError ( ) ;
409+ }
397410 } }
398411 fullWidth
399412 requiredSymbol
400- maxLength = { PASSWORD_MAX_LENGTH }
401413 SideComponent = {
402414 < button
403415 type = "button"
@@ -440,7 +452,13 @@ export default function ForgotPasswordPage() {
440452 < Button
441453 type = "submit"
442454 fullWidth
443- disabled = { ! password || ! confirmPassword || isLoading }
455+ disabled = {
456+ ! password ||
457+ ! confirmPassword ||
458+ isLoading ||
459+ password . length > PASSWORD_MAX_LENGTH ||
460+ confirmPassword . length > PASSWORD_MAX_LENGTH
461+ }
444462 >
445463 { isLoading ? "Updating..." : "Update" }
446464 </ Button >
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ export const ResetPassword: FC<ResetPasswordProps> = ({ isAfterLogin }) => {
6969 placeholder = "Enter new password"
7070 requiredSymbol
7171 type = { showNewPassword ? "text" : "password" }
72- maxLength = { PASSWORD_MAX_LENGTH }
7372 helpText = {
7473 errors . newPassword
7574 ? ""
@@ -96,7 +95,6 @@ export const ResetPassword: FC<ResetPasswordProps> = ({ isAfterLogin }) => {
9695 placeholder = "Confirm password"
9796 requiredSymbol
9897 type = { showConfirmPassword ? "text" : "password" }
99- maxLength = { PASSWORD_MAX_LENGTH }
10098 error = { errors . confirmPassword ?. message }
10199 fullWidth
102100 SideComponent = {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type { FC } from "react";
1111
1212import styles from "./sign_in_form.module.scss" ;
1313import { useSignInForm } from "./use_sign_in_form" ;
14+ import { PASSWORD_MAX_LENGTH } from "@oko-wallet-ct-dashboard/constants" ;
1415import { AccountForm } from "@oko-wallet-ct-dashboard/ui" ;
1516
1617export const SignInForm : FC = ( ) => {
@@ -54,6 +55,7 @@ export const SignInForm: FC = () => {
5455 type = "password"
5556 placeholder = "Password"
5657 fullWidth
58+ maxLength = { PASSWORD_MAX_LENGTH }
5759 error = { errors . password ?. message }
5860 resetError = { ( ) => resetErrors ( "password" ) }
5961 { ...register ( "password" ) }
You can’t perform that action at this time.
0 commit comments