-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reset password #1119
feat: reset password #1119
Conversation
如果加密密码已成定局的话,建议使用 go-keying 库。(也被 GitHub CLI 使用) 可以使用此库先将密码保存到系统自带的密钥环(keyring)中,不行再保存到配置文件中。 |
有些系统可能不支持吧。不行再保存至配置文件中,这样感觉更加复杂了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
复杂度确实无解,放弃了。
util/bcrypt.go
Outdated
} | ||
|
||
// CheckPassword 检查密码 | ||
func CheckPassword(hashedPassword, password string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数名和 config
包里的冲突,干的活也不一样,容易混淆。可以尝试改名叫 PasswordOK
。
|
||
// CheckPassword 检查密码 | ||
func (conf *Config) CheckPassword(newPassword string) (hashedPwd string, err error) { | ||
var minEntropyBits float64 = 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当时定的强度有点高,可以调低点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
外网访问50,差不多。内网25
main.go
Outdated
var customDNS = flag.String("dns", "", "Custom DNS server address, example: 8.8.8.8") | ||
|
||
// 重置密码 | ||
var newPassword = flag.String("password", "", "Reset password") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var newPassword = flag.String("password", "", "Reset password") | |
var resetPassword = flag.String("resetPassword", "", "Reset password to the one entered") |
如果不看描述的话,看不出来这个标志到底是用来重置密码,还是用传递的密码登录的。
可以改为使用 bool 标志,然后随机生成一个密码或者从 stdin 读取。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md中有说明,也有描述。
改为使用 bool 标志,然后随机生成一个密码或者从 stdin 读取。
感觉稍微复杂了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
描述:Reset password, example: ./ddns-go -password 123456
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
描述:
Reset password, example: ./ddns-go -password 123456
?
重置密码是个低频操作,把标志名改成 resetPassword
应该就够了,不需要示例。
-resetPassword string
Reset password to the one entered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以
What does this PR do?
fix: #1100 #1022 #934 #554
Motivation
Additional Notes