Jump to content

Recommended Posts

Posted

I have a front end login form and I would like to compare password that user inputs with the password in the system (database).

How can I do it because password in database is hashed and salted so I can throw them an error if they put in the wrong password.

Posted

You can do this:

if($user->pass->matches("yourpassword")){
  // correct
}

But normally you just login and if it fails you know it's wrong.

if($session->login("nam","password")){
   // logged in
}
  • Like 3
Posted
if($user->pass->matches
if($session->login

If I go to the api cheatsheet I see $user->pass and $session-> but I can't find anything about the parts "->matches" after pass, and "->login" after $session. I am sure that I am overlooking something that must be obvious but where can I find more about this ?

Posted
The InputfieldPassword::matches isn't in there since it was also not in API documentation and also belongs to the InputfieldPassword module which is not part of the cheatsheet.

The matches() function has actually been moved to be part of the Password value itself, so this is one thing I will add to the 2.3 API docs. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...