diff --git a/init_data.json.template b/init_data.json.template index a2bcbe7e..db278a60 100644 --- a/init_data.json.template +++ b/init_data.json.template @@ -123,7 +123,7 @@ "redirectUris": [""], "expireInHours": 168, "failedSigninLimit": 5, - "failedSigninfrozenTime": 15 + "failedSigninFrozenTime": 15 } ], "users": [ diff --git a/object/application.go b/object/application.go index 5fd4b37f..abff4bee 100644 --- a/object/application.go +++ b/object/application.go @@ -100,7 +100,7 @@ type Application struct { FormBackgroundUrl string `xorm:"varchar(200)" json:"formBackgroundUrl"` FailedSigninLimit int `json:"failedSigninLimit"` - FailedSigninfrozenTime int `json:"failedSigninfrozenTime"` + FailedSigninFrozenTime int `json:"failedSigninFrozenTime"` } func GetApplicationCount(owner, field, value string) (int64, error) { @@ -387,8 +387,8 @@ func GetMaskedApplication(application *Application, userId string) *Application if application.FailedSigninLimit == 0 { application.FailedSigninLimit = DefaultFailedSigninLimit } - if application.FailedSigninfrozenTime == 0 { - application.FailedSigninfrozenTime = DefaultFailedSigninfrozenTime + if application.FailedSigninFrozenTime == 0 { + application.FailedSigninFrozenTime = DefaultFailedSigninFrozenTime } return application diff --git a/object/check.go b/object/check.go index 1a53c564..becb5493 100644 --- a/object/check.go +++ b/object/check.go @@ -29,7 +29,7 @@ import ( const ( DefaultFailedSigninLimit = 5 - DefaultFailedSigninfrozenTime = 15 + DefaultFailedSigninFrozenTime = 15 ) func CheckUserSignup(application *Application, organization *Organization, form *form.AuthForm, lang string) string { @@ -143,7 +143,7 @@ func CheckUserSignup(application *Application, organization *Organization, form } func checkSigninErrorTimes(user *User, lang string) error { - failedSigninLimit, failedSigninfrozenTime, err := GetFailedSigninConfigByUser(user) + failedSigninLimit, failedSigninFrozenTime, err := GetFailedSigninConfigByUser(user) if err != nil { return err } @@ -151,7 +151,7 @@ func checkSigninErrorTimes(user *User, lang string) error { if user.SigninWrongTimes >= failedSigninLimit { lastSignWrongTime, _ := time.Parse(time.RFC3339, user.LastSigninWrongTime) passedTime := time.Now().UTC().Sub(lastSignWrongTime) - minutes := failedSigninfrozenTime - int(passedTime.Minutes()) + minutes := failedSigninFrozenTime - int(passedTime.Minutes()) // deny the login if the error times is greater than the limit and the last login time is less than the duration if minutes > 0 { diff --git a/object/check_util.go b/object/check_util.go index 1d5e3bed..e3142a16 100644 --- a/object/check_util.go +++ b/object/check_util.go @@ -58,12 +58,12 @@ func GetFailedSigninConfigByUser(user *User) (int, int, error) { failedSigninLimit = DefaultFailedSigninLimit } - failedSigninfrozenTime := application.FailedSigninfrozenTime - if failedSigninfrozenTime == 0 { - failedSigninfrozenTime = DefaultFailedSigninfrozenTime + failedSigninFrozenTime := application.FailedSigninFrozenTime + if failedSigninFrozenTime == 0 { + failedSigninFrozenTime = DefaultFailedSigninFrozenTime } - return failedSigninLimit, failedSigninfrozenTime, nil + return failedSigninLimit, failedSigninFrozenTime, nil } func recordSigninErrorInfo(user *User, lang string, options ...bool) error { @@ -72,7 +72,7 @@ func recordSigninErrorInfo(user *User, lang string, options ...bool) error { enableCaptcha = options[0] } - failedSigninLimit, failedSigninfrozenTime, errSignin := GetFailedSigninConfigByUser(user) + failedSigninLimit, failedSigninFrozenTime, errSignin := GetFailedSigninConfigByUser(user) if errSignin != nil { return errSignin } @@ -101,5 +101,5 @@ func recordSigninErrorInfo(user *User, lang string, options ...bool) error { } // don't show the chance error message if the user has no chance left - return fmt.Errorf(i18n.Translate(lang, "check:You have entered the wrong password or code too many times, please wait for %d minutes and try again"), failedSigninfrozenTime) + return fmt.Errorf(i18n.Translate(lang, "check:You have entered the wrong password or code too many times, please wait for %d minutes and try again"), failedSigninFrozenTime) } diff --git a/swagger/swagger.json b/swagger/swagger.json index 6ddfb944..44faf4cf 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -5418,7 +5418,7 @@ "type": "integer", "format": "int64" }, - "failedSigninfrozenTime": { + "failedSigninFrozenTime": { "type": "integer", "format": "int64" }, diff --git a/swagger/swagger.yml b/swagger/swagger.yml index 9aa057e1..c240d39c 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -3549,7 +3549,7 @@ definitions: failedSigninLimit: type: integer format: int64 - failedSigninfrozenTime: + failedSigninFrozenTime: type: integer format: int64 forgetUrl: diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index c7c24a3c..6adff4f1 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -437,8 +437,8 @@ class ApplicationEditPage extends React.Component { {Setting.getLabel(i18next.t("application:Failed signin frozen time"), i18next.t("application:Failed signin frozen time - Tooltip"))} : - { - this.updateApplicationField("failedSigninfrozenTime", value); + { + this.updateApplicationField("failedSigninFrozenTime", value); }} />