Login workflow and example for Expressive 3

expressive
authentication

#1

Hi,

I started a new project with Expressive 3. I need authentication with a login page, users in a database, … basic things at this time.

I found only one example of login process that @samsonasik made (https://samsonasik.wordpress.com/2018/01/12/create-login-functionality-in-expressive-3/) but i cannot apply all to expressive 3 final version.

It use things like that in handle… $response = $handler->handle($request);

Is someone can explain me the flow or have a up to date example that work with the current expressive version?

Thanks!


#2

I’ve updated the post to use latest compatible expressive components.


#3

Thanks for your update @samsonasik ! But i still have problem (password_verify in UserRepository /PdoDatabase line 68 return false) and have a question for you…

In the table “users” the password is hashed, so when a user try login, enter his username and password (raw) in the form…

Where is the treatment for “hashing” the password entered to be compared with the hash in the database?

Thanks!


#4

In the user repository Zend\Expressive\Authentication\UserRepository\PdoDatabase:

See also: http://php.net/manual/en/function.password-verify.php


#5

My mistake… i didn’t understood well the password_verify function… i thought it compare only value…
I just created a new hash with password_hash(), add in database and now all is fine for this step!

Thanks @samsonasik and @froschdesign!