Joomla user registration plugin - joomla

I am interested in customizing the authentication method for a Joomla website.
There is a comprehensive tutorial on how to make a custom authentication plug-in, however a plug-in of that sort customizes the behavior on each log-in.
The behavior I need to implement should occur only once during registration. Is there any way to implement this?

You'll want to create a user plugin that responds to the onBeforeStoreUser event instead of an authentication plugin. The plugin creation process is much the same for user plugins. The onBeforeStoreUser event receives two arguments: the user object and a boolean flag indicating whether or not the user is a new one.
You can look at plugins/user/example.php to see all of the user plugin event handlers.

Related

Can I register a plug-in on the user login event in Dynamics CRM?

I want to register a plug-in in Plugin Registration Tool when a user logs in to Dynamics CRM. For this I don't want to use Audit. I want to catch the login event directly.
If this is not possible, is there any log that is create in every login of the user.
As far as I know, No you cannot do so.
But CRM has provided few different ways where you can check which users are currently working/logged in.
Go to Settings--> System Settings--> Auditing and then you can enable audit user access.
Above will enable for all users and then you can see audit data as below.
Ref for 1st option https://blogs.msdn.microsoft.com/emeadcrmsupport/2015/07/09/dynamics-crm-audit-user-access-data/
Now another way you can do so it visit url https://admin.powerplatform.microsoft.com/
Here go under analytics and then common data service. You wil get most of the info
High level design of what I would do:
Make/identify a default dashboard for all users and keep a HTML web resource in there
Web resource can have a method to invoke Xrm.WebApi.online.execute for executing a Custom Action by passing parameter to include IP, Lat, Lon, Browser details. Read more
Register a plugin on Custom Action message to trigger and achieve what you want there

Custom logic on social Login

Is there any way to override the default social login providers and add some additonal functionality?
I would like to create an account directly as soon as the first login takes place.
Also I would like to know where the auth controller is implemented. Could not find it within https://github.com/Azure/azure-mobile-apps-net-server repository.
Where are these login/auth controllers are coming from?
The authentication providers are in a module sitting in front of your service, so the authentication already happens before you get there. You cannot add functionality to this module.
What you can do is call a custom API on login. Normally, you would use the client.loginAsync() or client.loginWithProvider() methods (depending on the SDK in use). Immediately after the login routine returns, call the client.invokeApi() (or the Async version) to call a custom API to do whatever you need to.

How to call Submit from Credential Provider

As far as I could understand, when the user presses the Submit button eventually, the GetSerialization method will be called to get login details.
I am programming a Credential Provider that waits for some external signal to log in, and I do not want the user to press the Submit button.
Is it possible to trigger the submit event from the Credential Provider?
I found a way to do it. The trick is not to call the submit button, but use the ICredentialProviderEvents::CredentialsChanged method. I have a thread running, that will eventually trigger the CredentialsChanged. This will then enable a new Credential that logs the user in.
This is shown in the Microsoft Sample SampleHardwareEventCredentialProvider.
It is worth notice that the Windows LogonUI automatically selects this new Credential. I do not know if this is in the documentation, but it is the behaviour I experienced.
The more appropriate way would be to implement the IConnectableCredentialProviderCredential interface, which is designed specifically for this purpose.

Custom Joomla authorization

The situation is quite complicated and why do I need it - do not ask - boss want!
So, immediately after the default authorization i need to run the custom module, which will have an additional test for authorization in another database and depending on its result i need to decide authorize user or not.
Are there any suggestions except for source corrections?
If you are using Joomla's built-in 'Login Menu', you can set 'Login Redirect' parameter to another page and if you are using Joomla's native login module, you can set redirect parameter to any page of your site that you want.
In your case I would recommend to create a simple component (not a module) that authorizes your user for second time, and redirects them again to any other page that you want (if second login was successful) or kick the user (if second login was unsuccessful). If you do that, you'll be able to create a menu for your component and redirect your login panel (either it's a menu or a simple login module) to your component's menu.
Creating components for Joomla is not a big deal if you have a little of knowledge in php programming and there are some tools that may speed up creating your component, like this one: http://www.notwebdesign.com/joomla-component-creator/
Why not make an authentication plugin and use that rather than the core joomla one?
This is for 1.5 but the principles are the same now.
http://docs.joomla.org/Creating_an_Authentication_Plugin_for_Joomla_1.5
Are the Joomla login credentials for a user the same as the other system that you are using? If so, then you can create a plugin that passes those credentials to your other system on a successful Joomla login event.
If not, then it gets a little tricky. Either your users will have to provide both sets of credentials, once for Joomla that then redirects to your other system for the second login, or you will have to extend your user accounts so you can associate the second set of credentials to a user. You can then use a plugin to pass the related credentials to your secondary system after a successful Joomla login event.

Want to allow Joomla Super Admin to log into other registered accounts - how to do it?

We've created a highly customized Joomla 1.5 based site and want our super administrator to be able to log into registered user accounts so we can provide better phone support and help them configure their accounts remotely.
This will obviously take some coding. Ideally we want a link from the admin side that will take us to the front end and automatically log us in as the registered user. We'll lock it down by IP address and also have some sort of password as well.
Where does the login get processed? It looks like /components/com_user/controller.php calls a function called $mainframe -> login(); Where does that function reside?
Our thought is to send a mock login form along with an additional super-user password field. Then we'll modify the login code to authorize the login if the password is present and the IP address is correct.
Any words of wisdom or caution with this approach?
There is actually a plugin that will do just this:
http://extensions.joomla.org/extensions/access-a-security/authentication/4806
You'll want to build an authentication plugin to handle this. You can enable as many authentication plugins as you like (the core plugin, OpenID, your own plugin, etc...). Joomla will run down the list of enabled plugins until one of them sets the status variable of the $response object to JAUTHENTICATE_STATUS_SUCCESS. The $response object gets passed in to your plugin's onAuthenticate method. Take a look at plugins/authentication/example.php for a clear example. You will probably end up cloning plugins/authentication/joomla.php and repurposing it for your needs.
I would publish your custom plugin after the core Joomla authentication plugin so that normal users will be able to log in faster.
Also, if you do want to go with a form as well, you will need to build a small component so that you can get the username and super-user password into the request.

Resources