Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
User Registration Module?
  • I am new to FuelPHP, and putting a big project together quickly, so I suspect I am going to have a number of stupid questions over the next few days. The documentation looks good, and I am finding my way around that, but my needs tend to fall into the "to be completed" sections of the documentation. The first thing I am tackling is user registration. I need something similar to the registration process on this site, but with a few extras. Firstly, users may be logging into the FuelPHP site and so have a session there, but authentication is done using SimpleSAMLphp. That means there is no need to store any user details on the FuelPHP application. All details are stored remotely (on a remote CRM, accessed via a web service). So just as a conceptual approach, would I be creating a model for users that links into the remote user storage rather than a local database table? Would I then create drivers for this model, and a front-end module, linked to the auth package? The approach is kind of fuzzy for me at the moment, so if this approach is kind of in the right direction, then I can dig further into the details. So, on to user registration. Is the code for the registration on this site available for download, as a starting point? That would help to get me started at least. I would need to add a few additional states in (e.g. when a user enters their email address at the start, that address may already be attached to an external CRM contact record, or it may not - if not, then there would be an additional step to create that contact record, otherwise the system is just looking for a password to attach to that contact record) but that should hopefully be straight forward. Sorry if that jumps all over the place - there are so many things to learn here at once, that I've got a hundred questions. Thanks, -- Jason
  • This site isn't written in FuelPHP, so that option is out the window as to providing examples for you. I would opt for an auth driver that interacts with the backend authentication service. It allows you to use the rest of the Auth mechanism without having to do anything special. From a functional point of view, the way the interface to the backend is developed is not relevant. Your driver will have the defined interface, for example create_user(). Your application just calls Auth::create_user(), your driver will make sure this happens in the backend, with whatever checks needed. Advantage of this approach is also that you can build and test your app using the local db driver, you are not dependent on the connection with the (production?) CRM system. Switching to the CRM backend is then only a matter of configuration your "CRM-backend" driver instead of the simpleauth driver...
  • Harro Verton wrote on Wednesday 9th of November 2011:
    This site isn't written in FuelPHP, so that option is out the window as to providing examples for you.

    I should have come back and updated my question - I realised this after seeing another post that the site is written using CodeIgniter.
    Harro Verton wrote on Wednesday 9th of November 2011:
    I would opt for an auth driver that interacts with the backend authentication service. It allows you to use the rest of the Auth mechanism without having to do anything special.

    Cool. Some bed-time reading on drivers for me then.
    Harro Verton wrote on Wednesday 9th of November 2011:
    From a functional point of view, the way the interface to the backend is developed is not relevant. Your driver will have the defined interface, for example create_user(). Your application just calls Auth::create_user(), your driver will make sure this happens in the backend, with whatever checks needed. Advantage of this approach is also that you can build and test your app using the local db driver, you are not dependent on the connection with the (production?) CRM system. Switching to the CRM backend is then only a matter of configuration your "CRM-backend" driver instead of the simpleauth driver...

    That sounds promising. I need to check what the minimum fields are for creating a user in the back end system. I do believe first name and last name are separate mandatory fields, so I'll need to add those. Would they just go into the driver, or would they be coded into the user registration front-end too (which I will need to write)? I expect it will be both. The back end system also supports multiple email addresses, any of which can be used to log in at any time, but only one of which is the "main" email address. A user could log in as fred@example.com, but any emails that the system sends to that account (presumably the main email address that the driver returns) may actually go to fred.bloggs@example.co.uk, for example. I'm hoping that kind of thing will just slot in. Thanks for the tips. -- JJ
  • Just look at the SimpleAuth class to get an idea of the supported methods, their function, and the arguments they require (by lack of docs at the moment). As to the email address, you can hide that in the driver. Perform the login procedure with whatever email address was passed, and on succesful authentication, return the main email address as the email property of the user. And yes, as a registration process is application specific, you will have to write that.
  • Cool, thanks. Understanding the concepts is always half the battle. This will get me headed in the right direction. -- JJ

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion