Skip to content

Resolve "Cannot login with 2fa"

Luke Bennett requested to merge 27047-8-16-cannot-login-with-2fa into master

What does this MR do?

Fixes an issue with ldap users using 2fa and u2f auth.

This bug has occurred because of my use of dispatcher to conditionally execute the u2f flow javascript.

Currently the u2f code is called when the body tags data-page attribute value is sessions:create.

From a gif on #27047 (closed), I can see that for ldap users, the data-page attribute value is not sessions:create and is instead omniauth_callbacks:...(something about ldap).

The data-page value is returned from the body_data_page method. Seeing as I have no experience with devise, I have no idea all of the possible return values could be for the login page.

I'm not happy with this proposal.

  1. It messes up the already messy dispatcher.
  2. It will query for .js-login-page for every page as long as gon.u2f is not undefined.

This isn't application exploding stuff, but the ideal fix here would be to know exactly all of the possible namespace:controller_name:action_name combinations for the devise login to use the dispatcher case statement, rather than querying this DOM class.

Are there points in the code the reviewer needs to double check?

Does this even fix it? Is this devise.html.haml layout used for every possible login screen? If not, this will still break for a certain configuration.

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #27047 (closed)

Merge request reports