Adjust the deny access time limit with tfa email plugin for a user

Created on 2 September 2024, 3 months ago

Problem/Motivation

The TFA email plugin module was created based on the TFA issue described at this Drupal issue link ✨ Create "Email one-time-code" Validation Plugin & related Setup Plugin Closed: outdated . The module provides an option to set a validity period for the code sent via email, allowing up to a maximum of 10 minutes (600 seconds). However, due to a restriction in the TFA module that denies access after 5 minutes from the start of the TFA process, the user is asked to log in again, even though the code remains valid beyond the 5-minute mark.

Steps to reproduce

1. Install tfa and the tfa_email_otp β†’ module.
2. Enable TFA and select "TFA Email one-time password (EOTP)" as the Allowed validation plugin and Default Validation plugin
3. Choose the Code validity period in minutes to 10 for the TFA Email one-time password (EOTP) Validation settings.
4. Save the configs
5. Now login as an user with enabled tfa
6. send the code and wait for more than 5 minutes
7. It will ask the user to login and deny the access

Proposed resolution

Update this code in TfaLoginController.php to increase the time to 10 minutes to match it with the email plugin highest code validation period.

// Deny access, after 5 minutes since the start of the tfa process.
      if ($updated < (time() - 300)) {
        $temp_store->delete('tfa-entry-uid');
        return $access->andIf(AccessResult::forbidden('Timeout expired.'));
      }

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia Nadim Hossain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024