Skip to content

Fix two factor auth only working on the second try. - #700

Merged
steinkel merged 3 commits into
CakeDC:masterfrom
ndm2:issue/two-factor-auth-secret-regeneration
Jun 20, 2018
Merged

Fix two factor auth only working on the second try.#700
steinkel merged 3 commits into
CakeDC:masterfrom
ndm2:issue/two-factor-auth-secret-regeneration

Conversation

@ndm2

@ndm2 ndm2 commented Jun 13, 2018

Copy link
Copy Markdown

When no secret is set for a user, a new one is being generated and stored in the user record, however it's not being set in the session, so that on the subsequent POST request the secret is still not there, and a new one is being generated, which causes the verification to use the wrong secret.

After such a failed attempt the secret is present in the user record and will be fetched in LoginTrait::_afterIdentifyUser(), making it available in the session data so that no new secret is being generated, and the verification works.

ndm2 added 3 commits June 13, 2018 21:51
This patch ensures that a new secret is only generated in case the user
record doesn't already has a secret set.
Ensures that the user data is persisted in the storage configured for
the Auth component, and that the `secret_verified` flag is set
properly.
@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #700 into master will increase coverage by 1.26%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #700      +/-   ##
============================================
+ Coverage     80.37%   81.64%   +1.26%     
  Complexity      543      543              
============================================
  Files            52       52              
  Lines          1692     1694       +2     
============================================
+ Hits           1360     1383      +23     
+ Misses          332      311      -21
Impacted Files Coverage Δ Complexity Δ
src/Controller/Traits/LoginTrait.php 63.06% <100%> (+12.49%) 51 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1e5dee...c2f0491. Read the comment docs.

@steinkel
steinkel merged commit 4188f58 into CakeDC:master Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants