--- title: Reset password tags: v2 --- # 暫時使用舊的 API 之後可以參考此文件優化 # Reset password ## 規劃 - 參考之前 forgot password,randomstring.generate(8) 當作 code 寄 email 給 user 去驗證是否可以重設密碼 - 設定過期時間 兩種方法 1. mongodb TTL: 每分鐘去檢查然後將過期的資料刪除 2. 設定時間,後端自己算是否過期 - 參考: - https://cheatsheetseries.owasp.org/cheatsheets/Forgot_Password_Cheat_Sheet.html - https://andyyou.github.io/2017/09/06/your-nodejs-authentication-probably-wrong/ - https://blog.logrocket.com/implementing-a-secure-password-reset-in-node-js/ ## collection - reset_password ```=db { _id: ObjectId, code: string, email: string, created_at: date, // TTL } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up