1
votes

I've created a joomla plugin to authenticate same like normal joomla authentication, (intention is: i'm using civicrm on top of joomla, so based on civicrm membership status i want to update joomla user group for that user). Its working fine on plain joomla and Civicrm version(2.5.24).

When I tried the same plugin on my existing client site(2.5.20), its authenticating using joomla defualt authenticaiton and not using my plugin. I've installed my plugin and enabled it. but its not picking my authentication plugin.

Interestingly when I'm entering wrong user name or password its coming into my plugins "onUserAuthenticate" method. how can I get my plugin's "onUserAuthenticate" method works for all the time..

Thanks for your valuable support!!

1
what happens if you enter correct username,psw? Make sure the authentication works outside of joomla on the same server. Also you may want to change the order of authentication so that your plugin is run first - tomjm
thanks for your reply mate. I figured it out, its using joomla default authenticaiton plugin as its coming first in the order. quick questin. how can I make joomla authenticaiton plugin next to my plugin?? i've given its order 1, and joomla plugin coming after Gmail auth plugin. If I give 0 for both my plugin and joomla plugin, then joomla plugin coming first :( - Developer
By "next to" do you mean in parallel? - thats not possible, one must come first. - tomjm
not parallel. in the plugins list..joomla plugin is coming first. I want that to be ordered after my plugin - Developer
To reorder click on the the column header "ordering" then you have arrows to reorder or you can enter the number for the order then click save icon next to column header - tomjm

1 Answers

3
votes

I think the way Joomla authenticate user is that it use all enabled authentication plugin to authenticate your username/password.

If you want your plugin work all the time, you can disable other plugins. So Joomla will alway fall to your onUserAuthenticate method. But note: This only work if your site does not need any other authentication plugins.

From joomla docs

In order for successful authentication to occur, only one of the plugins needs to return a JAUTHENTICATE_STATUS_SUCCESS result.

Ref: https://docs.joomla.org/J3.x:Creating_an_Authentication_Plugin_for_Joomla#Wrapping_it_All_Up_and_Using_It

I once had a request to build a joomla site but clients only want Joomla admin login on admin site, on front-End, only api user can login. What I did is I disable all authentication plugin on Joomla and create my own plugin which will check if user is on front end or back end. I used joomla code for back-end logins and my code for front-end logins.

It work perfectly.