Refactor password validation and enhance localization (#35)
* Refactor password validation and enhance localization A new PasswordSchema is introduced to handle the password validation in a centralized way and is used across all authentication schemas. The password requirements are also altered with additional special character, number, and uppercase letter checks. Error messages now utilize localization to provide dynamic error notifications. * Sign out before impersonating a user This update adds a call to sign out before impersonating a user. This is an additional measure to ensure the security of the system, accentuating the isolation of user sessions. * Refactor password validation and refine password schemas The password validation process has been restructured. The 'PasswordSchema' is now split into two separate schemas - 'PasswordSchema' and 'RefinedPasswordSchema'. The logic for validating repeating passwords has been moved into a separate function named 'refineRepeatPassword'. This streamlines the password validation process and ensures consistency across password checks.
This commit is contained in:
committed by
GitHub
parent
298e70b738
commit
fbe7ca4c9e
@@ -9,6 +9,7 @@ import { Controller, FormProvider, useFormContext } from 'react-hook-form';
|
||||
|
||||
import { cn } from '../utils';
|
||||
import { Label } from './label';
|
||||
import {Trans} from "../makerkit/trans";
|
||||
|
||||
const Form = FormProvider;
|
||||
|
||||
@@ -156,7 +157,7 @@ const FormMessage = React.forwardRef<
|
||||
className={cn('text-[0.8rem] font-medium text-destructive', className)}
|
||||
{...props}
|
||||
>
|
||||
{body}
|
||||
{typeof body === 'string' ? <Trans i18nKey={body} defaults={body} /> : body}
|
||||
</p>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user