OK, firstly let me say out straight – I think this is a BRILLIANT plugin! I have long searched for a clean login option where I could do away with a dedicated login page (and therefore eliminate one more target for bots) and this plugin fits the bill perfectly. I have already incorporated it into my site (in beta) and will be using it live if I can resolve this issue.
Alright: clearly, as most people have found out, you CAN login with an email, instead of a username without any problems. SO, a bit more explanation is needed. There is ONE occasion when you cannot use an email address: if 2FA is turned on and only ONE 2FA is activated then, if a user who has NOT setup their 2FA and tries to login with an email instead of a username, the above error appears.
Let me explain. Here is the result of a detailed test.
Believe it or not, there are actually 96 different scenarios to logging in, calculated as follows: 6 templates and 4 2FA options (none, plus 3 options), which equates to: (6×1) [no 2FA] +(6×3) [choice: 1, 2, or 3] +(6×3) [choice: two set = 1+2, 1+3, or 2+3] +(6×1) [choice: all three] = 48×2 (username or email) = 96.
In 95 of the above scenarios, you can log in with either a username or email address: in ONE of these occasions, (where a User tries to login with their email address when 2FA is turned ON with just ONE option but the User has not setup their 2FA) the error will occur. If this happens then the plugin skips 2FA and redirection, and the code jumps to line 226 in login-with-ajax.php, which says as follows:
” ‘error’ => ‘Invalid nonce or user supplied.’, // not translated as this is a bug and edge (if at all) ” [sic]
I have tested each of the above 96 scenarios on two sets of browsers, Mozilla-based (including Firefox) and Chrome-based (including Microsoft Edge). I have not tested on an Apple Mac as I don’t have one. The above error is repeatable in that single circumstance described.
I think that, based on the comment the developer has entered in line 226, this is a known bug but that a user is not expected to get here. Hopefully now however, as the circumstances in which this CAN happen has been identified, the error can be addressed so that someone who has the email address and has guessed the password, cannot bypass the 2FA. Sorry, but I’m not a programmer so I cannot say WHY this happens, only show WHEN it happens. I hope this helps.