diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-25 00:08:34 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-25 00:08:34 +1000 |
commit | c1d59c629804337ceb42795fa50dc7eaf1fbd7c7 (patch) | |
tree | eb36408854f6d7c955a0a7f1a72ffd20d612f3fa /util/src | |
parent | Potential nick reset fix (diff) | |
download | server-c1d59c629804337ceb42795fa50dc7eaf1fbd7c7.tar.xz |
Literally don't be an idiot
Diffstat (limited to 'util/src')
-rw-r--r-- | util/src/entities/User.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 5ae90c7c..35aeea52 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -140,11 +140,9 @@ export class User extends BaseClass { email?: string; // email of the user setEmail(val?: string) { - if (val) { - val = adjustEmail(val); - if (!val) throw FieldErrors({ email: { message: "Invalid email", code: "EMAIL_INVALID" } }); - if (!val.match(/([a-z\d.-]{3,})@([a-z\d.-]+).([a-z]{2,})/g)) throw FieldErrors({ email: { message: "Invalid email", code: "EMAIL_INVALID" } }); - } + val = adjustEmail(val); + if (!val) throw FieldErrors({ email: { message: "Invalid email", code: "EMAIL_INVALID" } }); + if (!val.match(/([a-z\d.-]{3,})@([a-z\d.-]+).([a-z]{2,})/g)) throw FieldErrors({ email: { message: "Invalid email", code: "EMAIL_INVALID" } }); this.email = val; } |