File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import LoadingScreen from "@/components/common/loading-screen";
24
24
import { useAuth } from "@/app/auth/auth-context" ;
25
25
import { cn } from "@/lib/utils" ;
26
26
import { User , UserSchema } from "@/lib/schemas/user-schema" ;
27
+ import { isPasswordComplex } from "@/lib/password" ;
27
28
import { userServiceUri } from "@/lib/api-uri" ;
28
29
29
30
const fetcher = async ( url : string ) : Promise < User > => {
@@ -300,16 +301,6 @@ export default function UserSettings({ userId }: { userId: string }) {
300
301
}
301
302
} , [ newPassword , confirmPassword ] ) ;
302
303
303
- const isPasswordComplex = ( password : string ) => {
304
- const minLength = 8 ;
305
- const hasUpperCase = / [ A - Z ] / . test ( password ) ;
306
- const hasSpecialChar = / [ ! @ # $ % ^ & * ( ) _ + \- = \[ \] { } ; ' : " \\ | , . < > \/ ? ] + / . test (
307
- password
308
- ) ;
309
-
310
- return password . length >= minLength && hasUpperCase && hasSpecialChar ;
311
- } ;
312
-
313
304
if ( isLoading ) {
314
305
return < LoadingScreen /> ;
315
306
}
Original file line number Diff line number Diff line change
1
+ export const isPasswordComplex = ( password : string ) => {
2
+ const minLength = 8 ;
3
+ const hasUpperCase = / [ A - Z ] / . test ( password ) ;
4
+ const hasSpecialChar = / [ ! @ # $ % ^ & * ( ) _ + \- = \[ \] { } ; ' : " \\ | , . < > \/ ? ] + / . test (
5
+ password
6
+ ) ;
7
+
8
+ return password . length >= minLength && hasUpperCase && hasSpecialChar ;
9
+ } ;
You can’t perform that action at this time.
0 commit comments