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
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | email top.gif | 1.75 MB | mingsong |
| #3 | tfa-email-otp-ui.mp4 | 280.3 KB | nadim hossain |
| #3 | 3469826-disable-verify-button.patch | 3.5 KB | nadim hossain |
Issue fork tfa_email_otp-3469826
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
Comment #3
nadim hossain commentedAdding this patch version to get it used in the project for now -
Comment #4
nadim hossain commentedComment #5
jfurnas commentedWould 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.
Comment #6
mingsongIn 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.
Comment #7
mingsongThanks @Nadim Hossain for the patch. Is it possible to have functional tests for the new feature?
Comment #8
mingsongChange to 'Need work' as functional tests for the new feature required.
Comment #9
jfurnas commented@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.
Comment #10
brad.bulger commentedIf 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.
Comment #11
jfurnas commentedWe 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.
Comment #12
delzhand commentedIt 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.
Comment #14
mingsongMR !6 mergeable take a another approach and implement the test for this new feature.
Comment #15
mingsongComment #17
mingsongIt has been two weeks, so I take the silence as Yes!
Thanks every one.