An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: implement requestPasswordReset and resetPassword (MM-156) #51

Summary

  • Adds POST /xrpc/com.atproto.server.requestPasswordReset — accepts an email, generates a 1-hour single-use reset token (stored as SHA-256 hash, never plaintext), and always returns 200 regardless of whether the email exists to prevent account enumeration. Email delivery is stubbed as tracing::info! for v0.1.
  • Adds POST /xrpc/com.atproto.server.resetPassword — validates the token, hashes the new password with argon2id, and atomically marks the token used and updates accounts.password_hash. Returns 401 InvalidToken for unknown tokens and 400 ExpiredToken for expired or already-used tokens.
  • Adds ErrorCode::ExpiredToken (HTTP 400, serialised as PascalCase "ExpiredToken") to match the ATProto resetPassword lexicon exactly.
  • Adds V014 migration for the password_reset_tokens table (token_hash PK, did FK, expires_at, used_at nullable, created_at).

Test plan

  • cargo test -p relay -- request_password_reset reset_password — 14 tests covering happy path, anti-enumeration, token expiry, already-used token, malformed token, and DB side effects
  • cargo test -p common — verifies ExpiredToken serialises as "ExpiredToken" (PascalCase) and maps to HTTP 400
  • Bruno: open request_password_reset.bru against a local relay, confirm 200 response and token logged to stdout
  • Bruno: copy token from logs into reset_password.bru, confirm 200 and that a second call with the same token returns 400 ExpiredToken
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mhwjc5p5le22
Diff #0

No differences found between the selected revisions.

History

1 round 0 comments
sign up or login to add to the discussion
malpercio.dev submitted #0
patch application failed: error: No valid patches in input (allow with "--allow-empty")
expand 0 comments