feat(login): add login limit (#1023)

* feat(login): add login limit

* chore: rename vars

* chore: use `string`

* fix: clear the signin error times after succeessfull login

* chore: modify code position
This commit is contained in:
q1anx1
2022-08-17 01:39:53 +08:00
committed by GitHub
parent 70f2988f09
commit aedef1eea1
3 changed files with 73 additions and 2 deletions

View File

@ -111,6 +111,9 @@ type User struct {
Roles []*Role `json:"roles"`
Permissions []*Permission `json:"permissions"`
LastSigninWrongTime string `xorm:"varchar(100)" json:"lastSigninWrongTime"`
SigninWrongTimes int `json:"signinWrongTimes"`
}
type Userinfo struct {
@ -376,6 +379,7 @@ func UpdateUser(id string, user *User, columns []string, isGlobalAdmin bool) boo
"owner", "display_name", "avatar",
"location", "address", "region", "language", "affiliation", "title", "homepage", "bio", "score", "tag", "signup_application",
"is_admin", "is_global_admin", "is_forbidden", "is_deleted", "hash", "is_default_avatar", "properties", "webauthnCredentials",
"signin_wrong_times", "last_signin_wrong_time",
}
}
if isGlobalAdmin {