From 2d7c32ae20663a9a530cdf8b87eced1d59f0df67 Mon Sep 17 00:00:00 2001 From: zhiqiang feng Date: Mon, 26 Sep 2022 16:37:34 +0800 Subject: [PATCH] update password validator --- src/app/login/login.component.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index e352294..34e26f9 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -57,19 +57,11 @@ export class LoginComponent implements OnInit { } checkPattern(pw: string): boolean { - if (pw.length < 8) { - return false; - } - if (!/\d/.test(pw)) { - return false; - } - if (!/[A-Z]/.test(pw)) { - return false; - } - if (!/[a-z]/.test(pw)) { - return false; - } - if (!/[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(pw)) { + if (pw.length < 8 || + !/\d/.test(pw) || + !/[A-Z]/.test(pw) || + !/[a-z]/.test(pw) || + !/[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(pw)) { return false; } return true;