From c1d59c629804337ceb42795fa50dc7eaf1fbd7c7 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 25 Sep 2022 00:08:34 +1000 Subject: [PATCH] Literally don't be an idiot --- util/src/entities/User.ts | 8 +++----- 1 file 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; }