terminal42 / contao-autoregistration

Auto-login your Contao users after their registration or account activation.
MIT License
7 stars 7 forks source link

V2.0 Contao 4.5 #2

Closed richardhj closed 6 years ago

richardhj commented 6 years ago

It may occur that autoregistration does not work for Contao >=4.5 since the auth components changed.

I did a rework for Contao 4.5. The "auto login after activation" is tested. The "auto activation, auto login" not yet though.

Opening the PR here just in case somebody needs this extension.

aschempp commented 6 years ago

Wow, this looks great! I'll add some comments to minor things to change.

richardhj commented 6 years ago

Thanks for the feedback. Do you want to keep up the support of auto_activate_where.

richardhj commented 6 years ago

I added the trigger of the InteractiveLoginEvent as seen in https://ourcodeworld.com/articles/read/459/how-to-authenticate-login-manually-an-user-in-a-controller-with-or-without-fosuserbundle-on-symfony-3

Is this really necessary? A token should automatically be stored by the symfony listener.

I'll check that.

richardhj commented 6 years ago

I've implemented the feedback and am awaiting feedback on two of my comments above 😇

richardhj commented 6 years ago

Should be fine now. Thanks for all the feedback.

aschempp commented 6 years ago

Thanks a lot! I have merged this and added some fixes, can you please test the latest master branch before I tag the new version?

aschempp commented 6 years ago

The package is now available on packagist as well. Be aware that it won't show up in Contao Manager atm, you need to install it manually through composer.

richardhj commented 6 years ago

OK, one more thing:

The query looks like this atm: An exception occurred while executing 'UPDATE tl_member SET disable = WHERE id=?'

         if ($pageModel->auto_activate_registration) {
             $match = $this->connection->createQueryBuilder()
                 ->update('tl_member')
-                ->set('disable', '')
+                ->set('disable', ':disable')
                 ->where('id=:id')
+                ->setParameter(':disable', '')
                 ->setParameter('id', $userId)
                 ->execute()
             ;

But after all, I verified that both modes are working.

aschempp commented 6 years ago

Sorry for the delay. I have fixed all issues, can you please check again?

richardhj commented 6 years ago

Installed 14bc609 and verified that both auto login and auto activation are working as expected. 👍 👍

aschempp commented 6 years ago

Thanks! Finally released 😎 https://packagist.org/packages/terminal42/contao-autoregistration

Toflar commented 6 years ago

Do you also want to give it some extended and translated description for the manager? https://github.com/contao/package-metadata