nikola Posted March 26, 2013 Share Posted March 26, 2013 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. Link to comment Share on other sites More sharing options...
Soma Posted March 26, 2013 Share Posted March 26, 2013 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 } 3 Link to comment Share on other sites More sharing options...
pwired Posted March 26, 2013 Share Posted March 26, 2013 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 ? Link to comment Share on other sites More sharing options...
Soma Posted March 26, 2013 Share Posted March 26, 2013 http://processwire.com/api/cheatsheet/?filter=login&advanced 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. Not every method there is is on the cheatsheet, lots of more advanced stuff is left out. Soon we gonna add new stuff that's added recently in 2.3. 2 Link to comment Share on other sites More sharing options...
pwired Posted March 26, 2013 Share Posted March 26, 2013 Ok thanks Soma, that explains. (can stop banging my head on the wall ) Link to comment Share on other sites More sharing options...
nikola Posted March 26, 2013 Author Share Posted March 26, 2013 Soma, thanks for the answer! Link to comment Share on other sites More sharing options...
ryan Posted March 27, 2013 Share Posted March 27, 2013 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now