diff --git a/packages/pds/src/account-manager/index.ts b/packages/pds/src/account-manager/index.ts index c25e2ba01bc..469d942aea9 100644 --- a/packages/pds/src/account-manager/index.ts +++ b/packages/pds/src/account-manager/index.ts @@ -321,18 +321,14 @@ export class AccountManager { ) } - async updateEmail(opts: { did: string; email: string; token?: string }) { - const { did, email, token } = opts - if (token) { - await this.db.transaction((dbTxn) => - Promise.all([ - account.updateEmail(dbTxn, did, email), - emailToken.deleteAllEmailTokens(dbTxn, did), - ]), - ) - } else { - return account.updateEmail(this.db, did, email) - } + async updateEmail(opts: { did: string; email: string }) { + const { did, email } = opts + await this.db.transaction((dbTxn) => + Promise.all([ + account.updateEmail(dbTxn, did, email), + emailToken.deleteAllEmailTokens(dbTxn, did), + ]), + ) } async resetPassword(opts: { password: string; token: string }) { diff --git a/packages/pds/src/api/com/atproto/server/updateEmail.ts b/packages/pds/src/api/com/atproto/server/updateEmail.ts index 52d27a64ae4..db6e3fcc25e 100644 --- a/packages/pds/src/api/com/atproto/server/updateEmail.ts +++ b/packages/pds/src/api/com/atproto/server/updateEmail.ts @@ -45,7 +45,7 @@ export default function (server: Server, ctx: AppContext) { } try { - await ctx.accountManager.updateEmail({ did, email, token }) + await ctx.accountManager.updateEmail({ did, email }) } catch (err) { if (err instanceof UserAlreadyExistsError) { throw new InvalidRequestError(