Skip to content

Commit 27b2062

Browse files
author
Nandan Grover
committed
Updated flat validation
1 parent 02534ef commit 27b2062

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

client/src/screens/SignUp/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ const SignUp: React.FC<RouteComponentProps> = (props: RouteComponentProps) => {
106106
}
107107

108108
if (!validateFlat(flat)) {
109-
toast.error('Invalid Flat Number. Flat Number should be of type XX-NN', { autoClose: 6000 });
109+
toast.error('Invalid Flat Number. Flat Number should be of type X*-N* (Example: Sapphire-456)'
110+
, { autoClose: 6000 });
110111
return;
111112
}
112113
const { data }: ExecutionResult = await createUser({

client/src/utils/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const validatePassword = (password: string): boolean => {
2424
* Flat Number Validation
2525
*/
2626
const validateFlat = (flat: string): boolean => {
27-
if (/[A-Z]-[0-9{1-2}]/g.test(flat)) {
27+
if (/[((A-Z{1,9})|(a-z{1,9})]-[0-9{1-9}]/g.test(flat)) {
2828
return true;
2929
}
3030
return false;

0 commit comments

Comments
 (0)