Skip to content

Commit

Permalink
fix: update password minimum for LoginForm and RegisterForm
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Jul 12, 2024
1 parent b28f569 commit 0264c58
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 9 deletions.
7 changes: 7 additions & 0 deletions apps/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-docs

## 0.0.92

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.42.7

## 0.0.91

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-docs",
"version": "0.0.91",
"version": "0.0.92",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
Expand Down
7 changes: 7 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @sikka/hawa

## 0.42.7

### Patch Changes

- Change `passwordLength` prop to `minPasswordLength`
- Apply `minPasswordLength` to `RegisterForm`

## 0.42.6

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/components/blocks/auth/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ type LoginFormTypes = {
onTwitterLogin?: () => void;
/** Additional buttons to add under the login button */
additionalButtons?: any;
/** The allowed length of the password input field */
passwordLength?: number;
/** The minimum length of the password input field */
minPasswordLength?: number;
/** If true, the form is displayed without a card container styling.*/
cardless?: boolean;
/** Props to pass to the PhoneInput component */
Expand All @@ -84,7 +84,7 @@ type LoginFormTypes = {

export const LoginForm: FC<LoginFormTypes> = ({
loginType = "email",
passwordLength = 8,
minPasswordLength = 8,
texts,
...props
}) => {
Expand Down Expand Up @@ -113,7 +113,7 @@ export const LoginForm: FC<LoginFormTypes> = ({
required_error: texts?.password?.required || "Password Required",
})
.min(1, { message: texts?.password?.required || "Password Required" })
.min(passwordLength, {
.min(minPasswordLength, {
message: texts?.password?.tooShort || "Password too short",
}),
});
Expand All @@ -136,7 +136,7 @@ export const LoginForm: FC<LoginFormTypes> = ({
required_error: texts?.password?.required || "Password Required",
})
.min(1, { message: texts?.password?.required || "Password Required" })
.min(passwordLength, {
.min(minPasswordLength, {
message: texts?.password?.tooShort || "Password too short",
}),
});
Expand Down
9 changes: 8 additions & 1 deletion packages/components/blocks/auth/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ type RegisterFormTypes = {
form?: string;
card?: string;
};

/** The minimum length of the password input field */
minPasswordLength?: number;
/** If true, the form is displayed without a card container styling.*/
cardless?: boolean;
};

export const RegisterForm: FC<RegisterFormTypes> = ({
texts,
registerFields = ["email"],
minPasswordLength = 8,
showTermsOption = false,
showNewsletterOption = false,
...props
Expand Down Expand Up @@ -157,7 +161,7 @@ export const RegisterForm: FC<RegisterFormTypes> = ({
.string({
required_error: texts?.password?.required || "Password is required",
})
.min(5, {
.min(minPasswordLength, {
message: texts?.password?.tooShort || "Password is too short",
})
.refine((value) => value !== "", {
Expand All @@ -168,6 +172,9 @@ export const RegisterForm: FC<RegisterFormTypes> = ({
required_error:
texts?.confirm?.required || "Confirm password required",
})
.min(minPasswordLength, {
message: texts?.password?.tooShort || "Password is too short",
})
.refine((value) => value !== "", {
message: texts?.password?.required || "Confirm password is required",
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sikka/hawa",
"version": "0.42.6",
"version": "0.42.7",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
7 changes: 7 additions & 0 deletions packages/storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-storybook

## 0.26.113

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.42.7

## 0.26.112

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-storybook",
"version": "0.26.112",
"version": "0.26.113",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down

0 comments on commit 0264c58

Please sign in to comment.