born05 / craft-twofactorauthentication

Craft plugin for two-factor or two-step login using Time Based OTP.
MIT License
36 stars 26 forks source link

Craft 3 support #7

Closed espensgr closed 5 years ago

espensgr commented 6 years ago

Hey,

Any ETA for plugin store?

roelvanhintum commented 6 years ago

@espensgr We are working on Craft 3 support, but since we are not yet running projects on Craft 3 there is not a lot of time i get to spend on this. I'm hoping to get the plugin done in april. We will submit it same day we get the release done i'll submit it to the store.

espensgr commented 6 years ago

@roelvanhintum Good to know :thumbsup:

dowadidi commented 6 years ago

+1 😊

PRASS95 commented 6 years ago

+1

RichardJong commented 6 years ago

@roelvanhintum Thanks for the great work so far. Any idea if the launch of v3 is imminent? Otherwise we'll develop our own solution.

roelvanhintum commented 6 years ago

I'm working on it. I'm hoping to get things working today. Sorry, for the insane delay. Luckily the Craft 3 docs are a lot better by now. 😄

roelvanhintum commented 6 years ago

Check 2.0.0-beta.1. It should be fully functional, i just didn't test it in a production environment yet! Please, let me know if you have any problems!

dowadidi commented 6 years ago

Will do! Thank you!

RichardJong commented 6 years ago

Thanks for the beta! However the plugin doesn't enforce the use of the 2FA code for admin pages, because of https://github.com/craftcms/cms/issues/2473

Steps to reproduce:

  1. Setup 2FA for your account
  2. Login with normal credentials
  3. Instead of entering 2FA code, go directly to http://yoursite/admin/dashboard
  4. You're fully logged in, despite not entering the 2FA code

Please correct me if I missed something

roelvanhintum commented 6 years ago

@RichardFrontwise Just tried to reproduce the issue, but i got logged out as supposed to. Can you give me some specifics about your settings? Do you have a different admin path or domain?

RichardJong commented 6 years ago

Did a clean craft install and the plugin works as expected! Discovered that the custom defaultCookieDomain in general.php causes the malfunction.

roelvanhintum commented 6 years ago

Thanks! Sounds like that should not influence the plugin. I will run some tests on changing the config:

RichardJong commented 6 years ago

Digging deeper: defaultCookieDomain results in a redirect loop. The login problem I described earlier is because another plugin has the checkPermission function in its init():

if (Craft::$app->getUser()->checkPermission('performUpdates')) {
    # code...
}
roelvanhintum commented 6 years ago

Ok, i'll look into hooking into this on a lower level. Right now it passes through authentication and logs out when the 2FA is not verified.

roelvanhintum commented 6 years ago

@RichardFrontwise in beta 2 the redirect loop should be fixed. I couldn't move the rest of the logic to a lower level due to some limitations in Craft's routing structure.

RichardJong commented 6 years ago

Awesome, thanks! Discovered another issue: if you enable the debug toolbar in the Control panel, the post call of the 2FA returns a 403 Unauthorized.

roelvanhintum commented 6 years ago

Debug toolbar issue is discussed in #9