Fix failedSigninFrozenTime typo

This commit is contained in:
Yang Luo 2024-01-13 02:12:29 +08:00
parent b1fe28fb83
commit 9b7f465a47
7 changed files with 17 additions and 17 deletions

View File

@ -123,7 +123,7 @@
"redirectUris": [""], "redirectUris": [""],
"expireInHours": 168, "expireInHours": 168,
"failedSigninLimit": 5, "failedSigninLimit": 5,
"failedSigninfrozenTime": 15 "failedSigninFrozenTime": 15
} }
], ],
"users": [ "users": [

View File

@ -100,7 +100,7 @@ type Application struct {
FormBackgroundUrl string `xorm:"varchar(200)" json:"formBackgroundUrl"` FormBackgroundUrl string `xorm:"varchar(200)" json:"formBackgroundUrl"`
FailedSigninLimit int `json:"failedSigninLimit"` FailedSigninLimit int `json:"failedSigninLimit"`
FailedSigninfrozenTime int `json:"failedSigninfrozenTime"` FailedSigninFrozenTime int `json:"failedSigninFrozenTime"`
} }
func GetApplicationCount(owner, field, value string) (int64, error) { func GetApplicationCount(owner, field, value string) (int64, error) {
@ -387,8 +387,8 @@ func GetMaskedApplication(application *Application, userId string) *Application
if application.FailedSigninLimit == 0 { if application.FailedSigninLimit == 0 {
application.FailedSigninLimit = DefaultFailedSigninLimit application.FailedSigninLimit = DefaultFailedSigninLimit
} }
if application.FailedSigninfrozenTime == 0 { if application.FailedSigninFrozenTime == 0 {
application.FailedSigninfrozenTime = DefaultFailedSigninfrozenTime application.FailedSigninFrozenTime = DefaultFailedSigninFrozenTime
} }
return application return application

View File

@ -29,7 +29,7 @@ import (
const ( const (
DefaultFailedSigninLimit = 5 DefaultFailedSigninLimit = 5
DefaultFailedSigninfrozenTime = 15 DefaultFailedSigninFrozenTime = 15
) )
func CheckUserSignup(application *Application, organization *Organization, form *form.AuthForm, lang string) string { 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 { func checkSigninErrorTimes(user *User, lang string) error {
failedSigninLimit, failedSigninfrozenTime, err := GetFailedSigninConfigByUser(user) failedSigninLimit, failedSigninFrozenTime, err := GetFailedSigninConfigByUser(user)
if err != nil { if err != nil {
return err return err
} }
@ -151,7 +151,7 @@ func checkSigninErrorTimes(user *User, lang string) error {
if user.SigninWrongTimes >= failedSigninLimit { if user.SigninWrongTimes >= failedSigninLimit {
lastSignWrongTime, _ := time.Parse(time.RFC3339, user.LastSigninWrongTime) lastSignWrongTime, _ := time.Parse(time.RFC3339, user.LastSigninWrongTime)
passedTime := time.Now().UTC().Sub(lastSignWrongTime) 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 // 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 { if minutes > 0 {

View File

@ -58,12 +58,12 @@ func GetFailedSigninConfigByUser(user *User) (int, int, error) {
failedSigninLimit = DefaultFailedSigninLimit failedSigninLimit = DefaultFailedSigninLimit
} }
failedSigninfrozenTime := application.FailedSigninfrozenTime failedSigninFrozenTime := application.FailedSigninFrozenTime
if failedSigninfrozenTime == 0 { if failedSigninFrozenTime == 0 {
failedSigninfrozenTime = DefaultFailedSigninfrozenTime failedSigninFrozenTime = DefaultFailedSigninFrozenTime
} }
return failedSigninLimit, failedSigninfrozenTime, nil return failedSigninLimit, failedSigninFrozenTime, nil
} }
func recordSigninErrorInfo(user *User, lang string, options ...bool) error { 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] enableCaptcha = options[0]
} }
failedSigninLimit, failedSigninfrozenTime, errSignin := GetFailedSigninConfigByUser(user) failedSigninLimit, failedSigninFrozenTime, errSignin := GetFailedSigninConfigByUser(user)
if errSignin != nil { if errSignin != nil {
return errSignin 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 // 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)
} }

View File

@ -5418,7 +5418,7 @@
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"failedSigninfrozenTime": { "failedSigninFrozenTime": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },

View File

@ -3549,7 +3549,7 @@ definitions:
failedSigninLimit: failedSigninLimit:
type: integer type: integer
format: int64 format: int64
failedSigninfrozenTime: failedSigninFrozenTime:
type: integer type: integer
format: int64 format: int64
forgetUrl: forgetUrl:

View File

@ -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"))} : {Setting.getLabel(i18next.t("application:Failed signin frozen time"), i18next.t("application:Failed signin frozen time - Tooltip"))} :
</Col> </Col>
<Col span={22} > <Col span={22} >
<InputNumber style={{width: "150px"}} value={this.state.application.failedSigninfrozenTime} min={1} step={1} precision={0} addonAfter="Minutes" onChange={value => { <InputNumber style={{width: "150px"}} value={this.state.application.failedSigninFrozenTime} min={1} step={1} precision={0} addonAfter="Minutes" onChange={value => {
this.updateApplicationField("failedSigninfrozenTime", value); this.updateApplicationField("failedSigninFrozenTime", value);
}} /> }} />
</Col> </Col>
</Row> </Row>