mirror of
https://github.com/jeessy2/ddns-go.git
synced 2024-11-25 16:46:24 +08:00
fix: password reset issue and handle missing config file (#1290)
* fix: password reset issue and handle missing config file * Add option to reset password with custom config file
This commit is contained in:
parent
2c4d8a82f8
commit
92354d6847
@ -64,6 +64,7 @@
|
||||
- 重置密码
|
||||
```bash
|
||||
./ddns-go -resetPassword 123456
|
||||
./ddns-go -resetPassword 123456 -c /Users/name/.ddns_go_config.yaml
|
||||
```
|
||||
- [可选] 使用 [Homebrew](https://brew.sh) 安装 [ddns-go](https://formulae.brew.sh/formula/ddns-go):
|
||||
|
||||
|
8
main.go
8
main.go
@ -94,8 +94,12 @@ func main() {
|
||||
}
|
||||
// 重置密码
|
||||
if *newPassword != "" {
|
||||
conf, _ := config.GetConfigCached()
|
||||
conf.ResetPassword(*newPassword)
|
||||
conf, err := config.GetConfigCached()
|
||||
if err == nil {
|
||||
conf.ResetPassword(*newPassword)
|
||||
} else {
|
||||
util.Log("配置文件 %s 不存在, 可通过-c指定配置文件", *configFilePath)
|
||||
}
|
||||
return
|
||||
}
|
||||
// 设置跳过证书验证
|
||||
|
@ -113,6 +113,7 @@ func init() {
|
||||
message.SetString(language.English, "登录失败次数过多,请等待 %d 分钟后再试", "Too many login failures, please try again after %d minutes")
|
||||
message.SetString(language.English, "用户名 %s 的密码已重置成功! 请重启ddns-go", "The password of username %s has been reset successfully! Please restart ddns-go")
|
||||
message.SetString(language.English, "需在 %s 之前完成用户名密码设置,请重启ddns-go", "Need to complete the username and password setting before %s, please restart ddns-go")
|
||||
message.SetString(language.English, "配置文件 %s 不存在, 可通过-c指定配置文件", "Config file %s does not exist, you can specify the configuration file through -c")
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user