Wednesday, 15 August 2012

php - How to authenticate with Sentinel by username? -


I am using Sentilis for authentication with PHP. E-mail and password are the traditional method of authenticating, as we can read in their documentation:

  $ credentials = ['email' = & gt; 'John.doe@example.com', 'password' = & gt; 'password', ]; Sentinel :: Certified ($ Credit);  

The default user table provided by the library is like this:

  id | Email | Password | Permissions | Last_logo | First_name | Made_at | Updated_at  

I want to add the username column and using the username and password by using the Sentinel I want to authenticate. Is this possible?

You can modify this example here

< P> In your user model you will have to override the attribute $ login names, and add the username to the $ filling attribute.

  Use Cornelist \ Sentinel \ Users \ EloquentUser as SentinelUser; Class user increases SentinelUser {protected $ fillable = ['email', 'username', 'password', 'last_name', 'first_name', 'permissions',]; Protected $ loginNames = ['username']; } Sentim :: Authentication (['Username' = & gt; 'fake', 'password' => = 'password']);  

No comments:

Post a Comment