For general locked-out users (those without admin-like roles) I think it's acceptable to relay trust to their email provider. If locked out, these people could initiate a TFA reset process where they're emailed a link that once clicked (and after verifying correct password) simply disables TFA for their account. This process could be limited to certain users (roles or code-based).

Provide a TFA plugin (for final tfa login form that can not be allowed for admin roles & module maintainer) and menu callback that validates link, user password, and does tfa disable.

Comments

drumm’s picture

Issue tags: +affects drupal.org
coltrane’s picture

Linking to https://www.drupal.org/node/2481253 since it has a similar purpose, perhaps could be unified.

pjcdawkins’s picture

Just so long as this is entirely optional (based on permissions?), as it weakens the point of TFA.

coltrane’s picture

Yes, it'll be an optional plugin (as well as per role) and it can form alter the admin page so as to warn about the security risk of enabling.

banviktor’s picture

Status: Active » Needs review
StatusFileSize
new12.79 KB

Here is a solution which uses the link generation algorithm from my #2481253: Allow Drush uli login command to bypass TFA patches (=> valid until login or 24 hours - configurable). The plugin is optional and when enabled a set of roles can be selected that can't use this plugin (defaults to administrator).

I had to extract the TFA disable process into tfa_basic_disable_tfa($account) to avoid code duplication.

banviktor’s picture

Should the default excluded roles be everything but the authenticated role?

banviktor’s picture

StatusFileSize
new12.63 KB
new2.06 KB

Default excluded roles are every role except authenticated. Also a watchdog event is recorded on a succesfull reset link access.

banviktor’s picture

Status: Needs review » Needs work

It wasn't such a bright idea working on the 2 issues simultaneously while sharing some of the solution's code. I will get back to this when #2481253: Allow Drush uli login command to bypass TFA is committed.

banviktor’s picture

Status: Needs work » Needs review
StatusFileSize
new12.72 KB
new1.59 KB

Keeping up with the changes made in #2481253: Allow Drush uli login command to bypass TFA.

Also added a tfa_logout() line in TfaBasicReset::validateForm().

banviktor’s picture

Status: Needs review » Postponed
Leeteq’s picture

edvanleeuwen’s picture

Tested and verified in combination with #2481253: Allow Drush uli login command to bypass TFA. Tried giving that a bump to be committed.