mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Fix failedSigninFrozenTime typo
This commit is contained in:
parent
b1fe28fb83
commit
9b7f465a47
@ -123,7 +123,7 @@
|
||||
"redirectUris": [""],
|
||||
"expireInHours": 168,
|
||||
"failedSigninLimit": 5,
|
||||
"failedSigninfrozenTime": 15
|
||||
"failedSigninFrozenTime": 15
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -5418,7 +5418,7 @@
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"failedSigninfrozenTime": {
|
||||
"failedSigninFrozenTime": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
|
@ -3549,7 +3549,7 @@ definitions:
|
||||
failedSigninLimit:
|
||||
type: integer
|
||||
format: int64
|
||||
failedSigninfrozenTime:
|
||||
failedSigninFrozenTime:
|
||||
type: integer
|
||||
format: int64
|
||||
forgetUrl:
|
||||
|
@ -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"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<InputNumber style={{width: "150px"}} value={this.state.application.failedSigninfrozenTime} min={1} step={1} precision={0} addonAfter="Minutes" onChange={value => {
|
||||
this.updateApplicationField("failedSigninfrozenTime", value);
|
||||
<InputNumber style={{width: "150px"}} value={this.state.application.failedSigninFrozenTime} min={1} step={1} precision={0} addonAfter="Minutes" onChange={value => {
|
||||
this.updateApplicationField("failedSigninFrozenTime", value);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
|
Loading…
x
Reference in New Issue
Block a user