Skip to content

Commit

Permalink
Merge branch 'multi-pds-auth' into signup-queueing-take2
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Feb 3, 2024
2 parents 1981dc9 + 346d04d commit e9783cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/pds/src/api/com/atproto/server/updateEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ export default function (server: Server, ctx: AppContext) {
await ctx.db.transaction(async (dbTxn) => {
const accntSrvce = ctx.services.account(dbTxn)

if (token) {
await accntSrvce.deleteEmailToken(did, 'update_email')
}
await accntSrvce.deleteAllEmailTokens(did)

if (user.email !== email) {
try {
await accntSrvce.updateEmail(did, email)
Expand Down
7 changes: 7 additions & 0 deletions packages/pds/src/services/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,13 @@ export class AccountService {
.executeTakeFirst()
}

async deleteAllEmailTokens(did: string) {
await this.db.db
.deleteFrom('email_token')
.where('did', '=', did)
.executeTakeFirst()
}

async assertValidToken(
did: string,
purpose: EmailTokenPurpose,
Expand Down

0 comments on commit e9783cf

Please sign in to comment.