0

My requirement is to do an additional custom validation once the users core joomla credentials are validated. If my custom validation fails then I should not allow the user to login.

I see there are only 2 plugin methods I can make use of it.

onUserLogin

This method will be called only after a successful login which is fine. If I return false it still allows the user to login to the website. I tried JFactory::getApplication()->logout(); but it still allows the user to login.

onUserAuthenticate

If I go via this route then I have to implement the whole authentication functionality on my own. (something like copy the core joomla authentication plugin and add my own code)

Is there a simplest way? I.e, once the core joomla authentication is complete I have to do an additional validation and if fails do not allow the member to login...

2

Actually there is another event you can perfectly use for this case.

It's onUserAfterLogin which gets called right after successful user login (core joomla authentication is complete). See source.

Then in this event, run your logic and simply call JFactory::getApplication()->logout(); if it fails. Just like you wanted it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.