feat: Allow admins to disable the login capability of an account #1272
Labels
No labels
Blocked
Bug
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
To-Merge
Wont fix
old/ci/cd
old/rust
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1272
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nex/feat/admin-disable-login"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This pull request allows admins to disable the login capability of an account without changing its password, locking, suspending, or disabling it. This is especially useful for bot accounts where you typically will not want them to be able to log in again after they've already got a session token (since they typically won't need to).
Also fixes a spec misinterpretation in #1266 that allowed locked users to log in but do nothing else (it makes no sense for them to be able to log in at all, so that check is now also performed during login)
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
@ -296,2 +298,4 @@}pub fn disable_login(&self, user_id: &UserId) {self.db.userid_login_disabled.insert(user_id, "1");Sob
Also this table doesn't follow naming convention, should be userid_logindisabled
@ -298,0 +304,4 @@pub fn enable_login(&self, user_id: &UserId) { self.db.userid_logindisabled.remove(user_id); }pub async fn is_login_disabled(&self, user_id: &UserId) -> bool {self.db.userid_logindisabled.get(user_id).await.is_ok()I think there's a function to check if a row with a key exists while ignoring the value (
contains?), that might be more idiomatic@ -1045,0 +1100,4 @@}self.services.users.enable_login(&user_id);self.write_str(&format!("{user_id} can now log in.")).awaitWe might want to return a note if the user in question was already able to log in?
I don't think that info's relevant by the time it reaches the user
some thoughts
thank you forgejo for interpreting that as three separate reviews
9c7c0e4e8f77e8fd1744Lgtm