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 | ac6e7f89477df0d3f667d8ceef76f9c68dde1556 (patch) | |
tree | 8b9446acf6a8abc0940fd8871d43c3f686e83421 | |
parent | Potential nick reset fix (diff) | |
download | server-ac6e7f89477df0d3f667d8ceef76f9c68dde1556.tar.xz |
Literally don't be an idiot
-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; } |