Skip to content

Commit

Permalink
Merge pull request #5630 from weseek/imprv/extend-minimum-password-le…
Browse files Browse the repository at this point in the history
…ngth

fix: Displaying minimum length of password
  • Loading branch information
yuki-takei committed Mar 31, 2022
2 parents 0ab6197 + d2910ae commit b584e2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
@@ -1,5 +1,6 @@
import { body, validationResult } from 'express-validator';

const PASSOWRD_MINIMUM_NUMBER = 8;
// form rules
export const registerRules = () => {
return [
Expand All @@ -18,8 +19,8 @@ export const registerRules = () => {
body('registerForm.password')
.matches(/^[\x20-\x7F]*$/)
.withMessage('Password has invalid character')
.isLength({ min: 6 })
.withMessage('Password minimum character should be more than 6 characters')
.isLength({ min: PASSOWRD_MINIMUM_NUMBER })
.withMessage('Password minimum character should be more than 8 characters')
.not()
.isEmpty()
.withMessage('Password field is required'),
Expand Down
5 changes: 3 additions & 2 deletions packages/app/src/server/routes/apiv3/user-activation.ts
Expand Up @@ -3,6 +3,7 @@ import * as express from 'express';
import { body, validationResult } from 'express-validator';
import ErrorV3 from '../../models/vo/error-apiv3';

const PASSOWRD_MINIMUM_NUMBER = 8;
// validation rules for complete registration form
export const completeRegistrationRules = () => {
return [
Expand All @@ -17,8 +18,8 @@ export const completeRegistrationRules = () => {
body('password')
.matches(/^[\x20-\x7F]*$/)
.withMessage('Password has invalid character')
.isLength({ min: 6 })
.withMessage('Password minimum character should be more than 6 characters')
.isLength({ min: PASSOWRD_MINIMUM_NUMBER })
.withMessage('Password minimum character should be more than 8 characters')
.not()
.isEmpty()
.withMessage('Password field is required'),
Expand Down

0 comments on commit b584e2a

Please sign in to comment.