dryb38654 2015-09-23 22:12
浏览 12
已采纳

“密码忘了”Php系统[关闭]

Which strategy is the best for recoving password. Email the user a link to create a new password, overriding the current one? or Email the user a randomly generated password, then ask them to change it?

  • 写回答

1条回答 默认 最新

  • duanjianlu0506 2015-09-23 22:23
    关注

    The first one.

    Create a form to get the user's email address.

    If the user does not exist in your system, send an email to that address saying "someone tried to reset your password but it's not in our system".

    If the user does exist in your system, create a link back to your site, and email the user that link. They click the link in the email and return to your site.

    The link should look like this:

    https://example.com/reset-password?email=$usersEmail&hmac=$hmacOfTheirEmail

    Confirm that the email has not been tampered with by checking the HMAC.

    To avoid user enumeration, return the same response from the form whether or not their email exists in your system.

    Depending on your level of security...

    • Log the user in
    • Ask them one or more security questions
    • Do multi-factor authentication

    Then force the user to change their password

    Some other answers/sites recommend storing tokens in the database. Ask Mozilla how that went.

    You could add some other parameters to that link such as expiry time and IP address. Make sure you include those in the HMAC too.

    To prevent replay attacks, include a hash of the user's old (and forgotten) password in the link.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?