Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SimpleAuth + User model?
  • Hello! I'm wondering how I would go about to use Auth together with a User model. From what I have read here on the forums you shouldn't use Auth to create/update Users, this should be done from the model. I'm just wondering how to use Auth together with my own User model when it comes to the hashing function etc. Early attempts to create users with my User model just led to me not being able to log in. I have set up a standard users table from the template @ http://fuelphp.com/docs/packages/auth/simpleauth/login.html. I'm not really sure as to how Auth works behind the scenes, as it seems to update the login_hash automatically among other things. Could anyone give me a simple example how I would go about to create a user using the user model so that the user will be able to log in using SimpleAuths login function? As it is now I am forced to edit the core Auth driver to add specific data due to relationships in the database and it is ugly and wrong, but it works for now at least, enabling me to move on with other parts of the project but I really dont like it. Thankful for any help!
  • I agree it's a bad way to do it but it helps to finsih the admin tutorial, so a big thank you
  • Nevermind I found Auths hash_password() and it worked fine using that function. If anyone runs in to the same problem I did I stored my password with
    $password_to_db = Auth::instance()->hash_password($plaintext_password);
    
  • on a side note, you should never 'edit' any core module. if there's really something you need a core module to do differently you would create a class in app/classes and
    overload a function of the core class. otherwise you'd have a hard time keeping your core library up to date.

Howdy, Stranger!

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

In this Discussion