feat(auth): add validatePassword function with requirements for min and max characters amount, presence of at least one uppercase letter, one lowercase letter, one digit and one special symbol; cover it with tests
This commit is contained in:
@@ -4,7 +4,7 @@ import { login, logout, register } from "../../../api";
|
||||
import { callApi } from "shared/utils";
|
||||
import { UNEXPECTED_ERROR_MESSAGE } from "shared/api";
|
||||
import { selectAuthData, selectFormValid } from "../../selectors";
|
||||
import { validateEmail } from "../../../lib";
|
||||
import { validateEmail, validatePassword } from "../../../lib";
|
||||
|
||||
export const defaultStoreState: Readonly<AuthStoreState> = {
|
||||
formData: {
|
||||
@@ -16,10 +16,6 @@ export const defaultStoreState: Readonly<AuthStoreState> = {
|
||||
error: null,
|
||||
};
|
||||
|
||||
function validatePassword(password: string): boolean {
|
||||
return Boolean(password);
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthStore>()((set, get) => ({
|
||||
...defaultStoreState,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user