Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

建议:登录模块内部密码md5可选 #839

Closed
bubao opened this issue Jul 5, 2020 · 1 comment
Closed

建议:登录模块内部密码md5可选 #839

bubao opened this issue Jul 5, 2020 · 1 comment

Comments

@bubao
Copy link

bubao commented Jul 5, 2020

环境

  • 系统/平台: Linux

  • nodejs 版本: 12

  • API版本:3.34.0

问题

建议登录密码md5可选,当用户传入md5的密码则不再执行md5。

这样做多人任务时,用户就不需要传明文密码进行登录。

建议代码

有两个方案,都需要增加新的请求参数md5_password,区别在于参数的类型。

方案一

// login.js
// query.md5_password: boolean 
const data = {
    username: query.email,
    password: query.md5_password ? query.password : crypto.createHash('md5').update(query.password).digest('hex'),
    rememberLogin: 'true'
}

此处query还是需要password

方案二

// login.js
// query.md5_password: string
const data = {
    username: query.email,
    password: query.md5_password ||  crypto.createHash('md5').update(query.password).digest('hex'),
    rememberLogin: 'true'
}

此处query不需要password

最后

在手机登录的api的password中也做此修改。

@Binaryify
Copy link
Owner

好了,已支持,采用了方案二

@bubao bubao closed this as completed Jul 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants