diff --git a/assets/openapi.json b/assets/openapi.json index 298ad18..3c57318 100644 --- a/assets/openapi.json +++ b/assets/openapi.json @@ -7627,6 +7627,9 @@ "type": "string" } }, + "tag": { + "type": "string" + }, "id": { "type": "string" } @@ -7658,6 +7661,7 @@ "security_keys", "sessions", "system", + "tag", "username", "verified", "webauthn_enabled" diff --git a/assets/schemas.json b/assets/schemas.json index a7d759f..46a3693 100644 --- a/assets/schemas.json +++ b/assets/schemas.json @@ -8097,6 +8097,9 @@ "type": "string" } }, + "tag": { + "type": "string" + }, "id": { "type": "string" } @@ -8129,6 +8132,7 @@ "security_keys", "sessions", "system", + "tag", "username", "verified", "webauthn_enabled" diff --git a/src/api/routes/auth/forgot.ts b/src/api/routes/auth/forgot.ts index 26e1b35..4ebb965 100644 --- a/src/api/routes/auth/forgot.ts +++ b/src/api/routes/auth/forgot.ts @@ -68,7 +68,7 @@ if (user && user.email) { Email.sendResetPassword(user, user.email).catch((e) => { - console.error(`Failed to send password reset email to ${user.username}#${user.discriminator} (${user.id}): ${e}`); + console.error(`Failed to send password reset email to ${user.tag} (${user.id}): ${e}`); }); } }, diff --git a/src/api/routes/auth/verify/resend.ts b/src/api/routes/auth/verify/resend.ts index 4c0339b..453c616 100644 --- a/src/api/routes/auth/verify/resend.ts +++ b/src/api/routes/auth/verify/resend.ts @@ -56,7 +56,7 @@ return res.sendStatus(204); }) .catch((e) => { - console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`); + console.error(`Failed to send verification email to ${user.tag}: ${e}`); throw new HTTPError("Failed to send verification email", 500); }); }, diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index 84471e0..d3c01c1 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -245,6 +245,13 @@ } } + public get tag(): string { + //const { uniqueUsernames } = Config.get().general; + const uniqueUsernames = false; + + return uniqueUsernames ? this.username : `${this.username}#${this.discriminator}`; + } + static async register({ email, username, @@ -310,7 +317,7 @@ // send verification email if users aren't verified by default and we have an email if (!Config.get().defaults.user.verified && email) { await Email.sendVerifyEmail(user, email).catch((e) => { - console.error(`Failed to send verification email to ${user.username}#${user.discriminator}: ${e}`); + console.error(`Failed to send verification email to ${user.tag}: ${e}`); }); }