From a78e13073f2fb070e15067d5fcc67797d890bc7e Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Fri, 24 Feb 2023 00:10:50 -0500 Subject: don't print anything if email send is successful --- src/api/routes/auth/verify/resend.ts | 3 +-- src/util/entities/User.ts | 34 +++++++++++++++------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/api/routes/auth/verify/resend.ts b/src/api/routes/auth/verify/resend.ts index d54ddf73..1cd14f23 100644 --- a/src/api/routes/auth/verify/resend.ts +++ b/src/api/routes/auth/verify/resend.ts @@ -37,8 +37,7 @@ router.post( } await Email.sendVerificationEmail(user, user.email) - .then((info) => { - console.log("Message sent: %s", info.messageId); + .then(() => { return res.sendStatus(204); }) .catch((e) => { diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index 42f74fb4..2947b205 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -16,6 +16,7 @@ along with this program. If not, see . */ +import { Request } from "express"; import { Column, Entity, @@ -24,23 +25,22 @@ import { OneToMany, OneToOne, } from "typeorm"; -import { BaseClass } from "./BaseClass"; -import { BitField } from "../util/BitField"; -import { Relationship } from "./Relationship"; -import { ConnectedAccount } from "./ConnectedAccount"; -import { Member } from "./Member"; -import { UserSettings } from "./UserSettings"; -import { Session } from "./Session"; import { + adjustEmail, Config, + Email, FieldErrors, Snowflake, trimSpecial, - adjustEmail, - Email, } from ".."; -import { Request } from "express"; +import { BitField } from "../util/BitField"; +import { BaseClass } from "./BaseClass"; +import { ConnectedAccount } from "./ConnectedAccount"; +import { Member } from "./Member"; +import { Relationship } from "./Relationship"; import { SecurityKey } from "./SecurityKey"; +import { Session } from "./Session"; +import { UserSettings } from "./UserSettings"; export enum PublicUserEnum { username, @@ -393,15 +393,11 @@ export class User extends BaseClass { // send verification email if users aren't verified by default and we have an email if (!Config.get().defaults.user.verified && email) { - await Email.sendVerificationEmail(user, email) - .then((info) => { - console.log("Message sent: %s", info.messageId); - }) - .catch((e) => { - console.error( - `Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`, - ); - }); + await Email.sendVerificationEmail(user, email).catch((e) => { + console.error( + `Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`, + ); + }); } setImmediate(async () => { -- cgit 1.4.1