Skip to content

Commit

Permalink
fix: prevent users from removing their Discord identity
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Dec 18, 2023
1 parent 4938553 commit 4cd4d96
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class ApiIdentityUserService {
if (!found) {
throw new Error(`Identity ${identityId} not found`)
}
if (found.provider === IdentityProvider.Discord) {
throw new Error(`You cannot delete your Discord identity.`)
}
await this.core.data.identityChallenge.deleteMany({ where: { identity: { id: identityId } } })
const deleted = await this.core.data.identity.delete({ where: { id: identityId } })
if (!deleted) {
Expand Down

0 comments on commit 4cd4d96

Please sign in to comment.