Skip to content

Commit 3cbc8f4

Browse files
Merge branch 'JuanPabloDiaz-juanDiaz'
2 parents 33f1791 + 9a55ea6 commit 3cbc8f4

File tree

3 files changed

+30
-40
lines changed

3 files changed

+30
-40
lines changed

appwrite-gen/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"schema:prepare": "yarn ts-node ./src/prepareSchema.ts"
99
},
1010
"dependencies": {
11+
"@types/react": "^18.3.2",
1112
"dotenv": "^16.3.1",
1213
"node-appwrite": "^11.1.0",
1314
"ts-node": "^10.9.2",
1415
"typescript": "^5.3.3"
1516
},
1617
"devDependencies": {
17-
"@types/node": "^20.11.0"
18+
"@types/node": "^20.12.12",
19+
"typescript": "^5.4.5"
1820
}
1921
}

src/components/pages/auth/register/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { setCookie } from "nookies";
1818
import { Models } from "appwrite";
1919

2020
const nameRegex: RegExp = /^[\sa-zA-Z]+$/;
21-
const passwordRegex: RegExp = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@_])[A-Za-z\d@_]{6,16}$/;
21+
const disallowedPasswordRegex: RegExp = /[^A-Za-z\d@_!#$%^&]/;
22+
const passwordRegex: RegExp = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@_!#$%^&])[A-Za-z\d@_!#$%^&]{6,24}$/;
2223

2324
export default function RegisterComponent() {
2425
const [showPassword, setShowPassword] = useState(false);
@@ -56,8 +57,12 @@ export default function RegisterComponent() {
5657
throw new Error("Password and Confirm Password does not match");
5758
}
5859

59-
if (data.password.length < 6 || data.password.length > 16) {
60-
throw new Error("Password should be in range of 6 to 16 characters");
60+
if (data.password.length < 6 || data.password.length > 24) {
61+
throw new Error("Password should be in range of 6 to 24 characters");
62+
}
63+
64+
if (disallowedPasswordRegex.test(data.password)) {
65+
throw new Error("Invalid password. Only the following special characters are allowed: @, _, !, #, $, %, ^, &");
6166
}
6267

6368
if (!passwordRegex.test(data.password)) {

yarn.lock

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -803,10 +803,10 @@
803803
resolved "https://registry.npmjs.org/@types/node/-/node-20.4.10.tgz"
804804
integrity sha512-vwzFiiy8Rn6E0MtA13/Cxxgpan/N6UeNYR9oUu6kuJWxu6zCk98trcDp8CBhbtaeuq9SykCmXkFr2lWLoPcvLg==
805805

806-
"@types/node@^20.11.0":
807-
version "20.11.28"
808-
resolved "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz"
809-
integrity sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==
806+
"@types/node@^20.12.12":
807+
version "20.12.12"
808+
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050"
809+
integrity sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==
810810
dependencies:
811811
undici-types "~5.26.4"
812812

@@ -831,6 +831,14 @@
831831
"@types/scheduler" "*"
832832
csstype "^3.0.2"
833833

834+
"@types/react@^18.3.2":
835+
version "18.3.2"
836+
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.2.tgz#462ae4904973bc212fa910424d901e3d137dbfcd"
837+
integrity sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==
838+
dependencies:
839+
"@types/prop-types" "*"
840+
csstype "^3.0.2"
841+
834842
"@types/scheduler@*":
835843
version "0.16.8"
836844
resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz"
@@ -4407,16 +4415,7 @@ string-argv@0.3.2:
44074415
resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz"
44084416
integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==
44094417

4410-
"string-width-cjs@npm:string-width@^4.2.0":
4411-
version "4.2.3"
4412-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
4413-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
4414-
dependencies:
4415-
emoji-regex "^8.0.0"
4416-
is-fullwidth-code-point "^3.0.0"
4417-
strip-ansi "^6.0.1"
4418-
4419-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
4418+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
44204419
version "4.2.3"
44214420
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
44224421
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -4485,14 +4484,7 @@ string.prototype.trimstart@^1.0.7:
44854484
define-properties "^1.2.0"
44864485
es-abstract "^1.22.1"
44874486

4488-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
4489-
version "6.0.1"
4490-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
4491-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
4492-
dependencies:
4493-
ansi-regex "^5.0.1"
4494-
4495-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
4487+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
44964488
version "6.0.1"
44974489
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
44984490
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -4795,10 +4787,10 @@ typescript@5.1.6:
47954787
resolved "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz"
47964788
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==
47974789

4798-
typescript@^5.3.3:
4799-
version "5.4.2"
4800-
resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz"
4801-
integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==
4790+
typescript@^5.4.5:
4791+
version "5.4.5"
4792+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
4793+
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
48024794

48034795
uc.micro@^2.0.0:
48044796
version "2.1.0"
@@ -4938,16 +4930,7 @@ which@^2.0.1:
49384930
dependencies:
49394931
isexe "^2.0.0"
49404932

4941-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
4942-
version "7.0.0"
4943-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
4944-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
4945-
dependencies:
4946-
ansi-styles "^4.0.0"
4947-
string-width "^4.1.0"
4948-
strip-ansi "^6.0.0"
4949-
4950-
wrap-ansi@^7.0.0:
4933+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
49514934
version "7.0.0"
49524935
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
49534936
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==

0 commit comments

Comments
 (0)