php - Accept username that is ecrypted by hash in the database -
When I am creating a user, the user name and password saves in a hash. Now, when I log in, I need my username and password, can be read by the system. I will write my code below for the user controller
public function postSignin () {if (Auth :: attempt '' Username ''), 'password' = & gt; input :: receive ('password'))) {return redirect: from ('admin / dashboard') - & gt; Together ('message', 'now you are logged in!'); } Else {return Redirect :: to ('users / login') - & gt; With ('message', 'your username / password combination was incorrect') - & gt; WithInput (); }}
case sensitivity does not require hashing If you have non-_CI encoding in the database table Use. CI means the case is insensitive.
Assuming that you still want to havehish usernames, you have to haveh to user input (username), in the same way it is stored in the database before passing it to the authentication script For
Comments
Post a Comment