-
Notifications
You must be signed in to change notification settings - Fork 845
Confirming 2FA lacks error message and refreshes page/state incorrectly (Inertia stack) #1028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ps-sean do you have any ideas here? |
As @ManuelLeiner mentioned, setting the error bag fixes the issue with the error not displaying. I manged to get the box to reopen by adding onError as below:
However, this flickers when the page reloads. I don't know enough about inertia to know why that happens unfortunately. |
It flickers because the function to enable 2fa initiates another roundtrip (POST) to the backend, including 1) new qr code, 2) new setup key, 3) changing the secret and recovery keys in the database. Then the user actually has to scan the new qr code. |
This seems to work better:
|
Could you have a look at the user in the database? I think that the user at this point has already been reset in database. What I mean by that is, that the What happens is:
The problem lies within |
Description:
This is an Inertia stack only problem. The Livewire stack works without any problems.
When enabling 2FA and providing a wrong or empty confirmation code, the user will not see any error message. The UI partially refreshes, e.g. buttons change but texts stay the same. I am happy to provide a PR as soon as I find the time. I do not know how trivial the solution actually is. I provided a solution for one part and some sources for the other part of the problem, see below.
Screen.Recording.2022-04-04.at.14.35.06.mov
Steps To Reproduce:
'confirm' => true,
(default)$user->two_factor_secret
is set in databasetwo_factor_secret
is null againMissing error message:
When provided a wrong/empty code, Fortify throws the validation error message into an error bag. Adding an additional option and provide the error bag name in the Vue component fixes that and the error can be retrieved as intended.
Refreshing page / state / user:
When starting the confirmation process,
$user->two_factor_secret
is set in the database. There is a computed property to check if 2FA is enabled. This computed property relies on the user'stwo_factor_secret
, see here. After providing a wrong/empty conformation code, this code will be executed and the user gets reset in the database. The computed property then changes its value fromtrue
tofalse
and partially refreshes the UI.The text was updated successfully, but these errors were encountered: