Skip to content

Commit

Permalink
chore: the time limit is set to 10 minutes (#1191)
Browse files Browse the repository at this point in the history
* chore: the time limit is set to 10 minutes

* docs: set up username and password immediately after logging in
  • Loading branch information
jeessy2 authored Jul 19, 2024
1 parent adfb42e commit d04149a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions util/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func init() {
message.SetString(language.English, "Callback调用失败, 异常信息: %s", "Webhook called failed! Exception: %s")

// save
message.SetString(language.English, "请在ddns-go启动后 5 分钟内完成初始化配置", "Please initialize configuration within 5 minutes after ddns-go starts")
message.SetString(language.English, "之前未设置帐号密码, 仅允许在ddns-go启动后 5 分钟内设置, 请重启ddns-go", "The username/password has not been set before, only allowed to set within 5 minutes after ddns-go starts, please restart ddns-go")
message.SetString(language.English, "请在ddns-go启动后 10 分钟内完成初始化配置", "Please initialize configuration within 10 minutes after ddns-go starts")
message.SetString(language.English, "之前未设置帐号密码, 仅允许在ddns-go启动后 10 分钟内设置, 请重启ddns-go", "The username/password has not been set before, only allowed to set within 10 minutes after ddns-go starts, please restart ddns-go")
message.SetString(language.English, "必须输入登录用户名/密码", "Must enter login username/password")
message.SetString(language.English, "密码不安全!尝试使用更复杂的密码", "Password is not secure! Try using a more complex password")
message.SetString(language.English, "数据解析失败, 请刷新页面重试", "Data parsing failed, please refresh the page and try again")
Expand Down
6 changes: 3 additions & 3 deletions web/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ <h5 data-i18n="Login" class="portlet__head">Login</h5>
if ('{{.EmptyUser}}' === 'true') {
showMessage({
content: i18n({
"en": "You have not set up a user yet, just click the Login button directly",
"zh-cn": "尚未设置用户, 请直接点击登录",
"en": "You have not set up a user yet. Please click Login button directly and be sure to set up your username and password immediately after logging in.",
"zh-cn": "尚未设置用户, 请直接点击登录,登录后请立即设置用户名和密码",
}),
type: "info",
duration: 60000,
duration: 300000,
});
}
</script>
Expand Down
10 changes: 5 additions & 5 deletions web/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func checkAndSave(request *http.Request) string {
accept := request.Header.Get("Accept-Language")
conf.Lang = util.InitLogLang(accept)

// 首次设置 && 必须在服务启动的 5 分钟内
if time.Now().Unix()-startTime > 5*60 {
// 首次设置 && 必须在服务启动的 10 分钟内
if time.Now().Unix()-startTime > 10*60 {
if firstTime {
return util.LogStr("请在ddns-go启动后 5 分钟内完成初始化配置")
return util.LogStr("请在ddns-go启动后 10 分钟内完成初始化配置")
}
// 之前未设置帐号密码 && 本次设置了帐号或密码 必须在5分钟内
// 之前未设置帐号密码 && 本次设置了帐号或密码 必须在10分钟内
if (conf.Username == "" && conf.Password == "") &&
(usernameNew != "" || passwordNew != "") {
return util.LogStr("之前未设置帐号密码, 仅允许在ddns-go启动后 5 分钟内设置, 请重启ddns-go")
return util.LogStr("之前未设置帐号密码, 仅允许在ddns-go启动后 10 分钟内设置, 请重启ddns-go")
}
}

Expand Down

0 comments on commit d04149a

Please sign in to comment.