doulan9419 2015-06-12 11:09
浏览 59
已采纳

禁用特定用户的密码哈希

We are using a single table for both admin and normal users. We need to save the admin password in hash format, but save the user password in plain text. How do do that with CakePHP 3.0

EDITED: User's username and password are used as a login credentials on another site as API. So i need to save password without hashing method of cakephp 3.0

  • 写回答

2条回答 默认 最新

  • doutingyou2198 2015-06-12 14:36
    关注

    As has been pointed out serveral times to you in the comments you should never store passwords as plain text in your database. This is regardless to whether or not they are being directly used by your app or not. As Anthony mentioned in his comment to your question you should consider storing encrypted passwords encrypted that can be reversed by your app.

    You should also check that the API you are using does not provide a more secure method for logging in using access tokens.

    If you want to persist with storing plain text passwords despite all this then you should consider storing them in a separate column to your hashed ones. For example:-

    id | username | password | api_login_password
    

    It would not be a good idea to mix the usage of the password column by having some records with encrypted passwords and others not.

    Using a schema like this you will not need to hash the api_login_password but continue to hash the app's passwords. Presumably you have CakePHP setup to hash the passwords on your User entity, this will not affect the api_login_password column.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料