Add option to unlock user accounts to site admin users menu#45650
Conversation
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 644d767 and a641750 or learn more. Open explanation
|
mrnugget
left a comment
There was a problem hiding this comment.
Very nice.
didn't know we had a REST API for this, TIL. I think keeping things consistent for now is a good idea, so adding a new endpoint here makes sense. But the property "isLocked" should probably go in the GraphQL API (see comment)
| """ | ||
| eventsCount: Float! | ||
| """ | ||
| Whether or not the user account is locked. |
There was a problem hiding this comment.
I'd add "Only visible to site-admins"
| time.Duration(lockoutOptions.LockoutPeriod)*time.Second, | ||
| time.Duration(lockoutOptions.ConsecutivePeriod)*time.Second, |
There was a problem hiding this comment.
Side-note: I'd expect this stuff to happen in a separate method in userpasswd somewhere, instead of in GraphQL layer.
Example: userpasswd.NewLockoutStoreFromConf(conf.AuthLockout()).
| db: db, user: user, logger: log.Scoped("userResolver", "resolves a specific user").With( | ||
| log.Object("repo", | ||
| log.String("user", user.Username))), |
There was a problem hiding this comment.
wow, that's not intendation, that's a massacre
| db: db, user: user, logger: log.Scoped("userResolver", "resolves a specific user").With( | |
| log.Object("repo", | |
| log.String("user", user.Username))), | |
| db: db, | |
| user: user, | |
| logger: log.Scoped("userResolver", "resolves a specific user").With(log.Object("repo", log.String("user", user.Username))), |
Also: what is that "repo" doing here?
There was a problem hiding this comment.
I did not change anything here, this was go fmt doing its thing 🤷
There was a problem hiding this comment.
Yeah, sometimes you need to help it and add linebreaks :P
Closes #40788
Adds an extra option to the user options in the Site Admin user management panel, allowing site admins to unlock user accounts after too many sign-in attempts.
I went with expanding the rest endpoints, since user lockouts are backed by a redis store that is created in that handler setup.
Test plan
Unit tests expanded.