We would like to enforce 2FA for all users on certain private wikis. This will require a bit of a different approach than 2FA enforcement based on group membership, because:
- Users on these wikis would never be able to disable 2FA, there's no group they can leave to make this possible
- Non-compliant users would need to be blocked, rather than removed from a group
- ...but they can't be "blocked" in the current meaning of that term, because that would disable their ability to log in and set up 2FA
- User creation would have to work differently. Right now new users get emailed a temporary password, and they log in with that then set a permanent password. We would have to require 2FA setup somewhere in this flow, but an account creator can't set up 2FA for someone else.
There are two approaches I can think of, and we should decide which one to use (or come up with a different one):
- Deny the "read" right for users without 2FA
- Non-compliant users would not be blocked, they would just lose the right to read anything. They could still log in and manage their 2FA, and regain read rights as soon as they do that.
- The user creation flow wouldn't really change, new users would log in with a temporary password and then be in the same state as non-compliant users: they can't read anything until they enable 2FA.
- Email recovery codes as a 2FA starter
- When a new user is created, enable 2FA for them immediately, with recovery codes only. Send them an email with their temporary password and their recovery codes. Then after logging in for the first time, direct them to set up 2FA properly.
- For non-compliant users, do the same thing: forcibly enable 2FA with recovery codes only, email those codes to them, and have them set up 2FA once they log in.
- This means restricting read rights isn't needed, and there is no state where a user account doesn't have 2FA.
- Add to the temporary password workflow
- When a new user is created, email them a temporary password as usual
- When they log in with their temporary password, we already force them to change it to a permanent password. In this same flow, also force them to set up 2FA
- (We would have to figure out whether this is feasible, and how we would prevent users from bypassing this requirement)
