Problem/Motivation

The tfa form has verify and send button enabled on the first load of the page. When the form loads first time there is no code to enter until the user hits send button. Keeping the verify button enabled might confuse the user and also does not make sense with the flow. The button should only be enabled after the verification code is sent by clicking the send button.
Also after clicking the send button, the button name should be renamed to Resend and this will give the user clear indication that the button has been clicked and the user can click again to Resend the code.

Steps to reproduce

  • TFA is turned on in the environment
  • Login as user for whom TFA is enabled
  • Two-factor authentication page is displayed after user enters correct password
  • Verify and Send button are enabled and both are functional.

Proposed resolution

Disable Verify button since it is not usable until the code has been send by the user.
Once the send button is clicked, enable the verify button and also change the value of the "Send" to "Resend"

Remaining tasks

User interface changes

Disable the verify button on first load of tfa form.

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Nadim Hossain created an issue. See original summary.

nadim hossain’s picture

StatusFileSize
new3.5 KB
new280.3 KB

Adding this patch version to get it used in the project for now -

nadim hossain’s picture

Status: Active » Needs review
jfurnas’s picture

Would a better solution be to just send the verification code when the TFA activation form is first displayed? Then the 'verify' button could stay, as well as the 'Send' button, but renamed to 'Resend' instead.

Seems counter-intuitive to have to click 'Send' first when you typically get the code sent automatically.

mingsong’s picture

In a situation where there are multiple TFA methods enabled, the user might want to switch to another TFA method rather than Email. I think it is good not to send a TFA Email to user by default until the user explicitly click the 'Send' button.

mingsong’s picture

Thanks @Nadim Hossain for the patch. Is it possible to have functional tests for the new feature?

mingsong’s picture

Status: Needs review » Needs work

Change to 'Need work' as functional tests for the new feature required.

jfurnas’s picture

@mingsong I am not sure I entirely agree with this.

The 'send' button is only rendered if email is setup as otp anyway (even with application code as well), so surely there's a way to trigger the automatic email if 'only' email otp is enabled. This is not only a user experience improvement but also a pretty standard practice.

At the very minimum, adding in some messaging on the page to indicate the user must first click 'send' to receive the code should be considered, as receiving the code automatically via email is a pretty standard practice in TFA, and without some messaging indicating users need to click it to even receive the first code isn't very use friendly.

brad.bulger’s picture

If it could automatically send the email when the form loads, that seems like what I'd expect. It doesn't have to be the only method enabled for the user.

But an explicit Send initially would be fine too. If the Send/Resend action was done with a link, always displaying the Verify button would be OK. If Send is a form button, it should be the only one at first. It could even be in a different form above the current one, since you want Verify to be first to be the default.

jfurnas’s picture

We are currently working on a patch for this that enables a couple of global configuration options.

The first option allows you to toggle on/off 'send email automatically', which sends the email otp code on form load automatically. The button changes to say 'Resend'.

If the first option is not selected, it appends some additional (configurable) language to the form explicitly instructing the users to click the 'Send' button to receive their code. After they click send the button changes to 'Resend' instead of 'Send'.

The ability to switch TFA auth types remains the same.

delzhand’s picture

It is counter-intuitive to show a form field to enter a value that a user will not have received. That's not how users expect 2FA to work. I spent 10 minutes trying to figure out email deliverability issues before I realized you have to click Send. It's not even the first button in the actions.

mingsong’s picture

Status: Needs work » Needs review
StatusFileSize
new1.75 MB

MR !6 mergeable take a another approach and implement the test for this new feature.

gif

mingsong’s picture

  • mingsong committed 833dfe33 on 1.0.x
    Issue #3469826 by jfurnas, mingsong, nadim hossain, brad.bulger: Disable...
mingsong’s picture

Status: Needs review » Fixed

It has been two weeks, so I take the silence as Yes!

Thanks every one.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.