04-17-2016, 01:53 PM
So... I decided to make a quick new page and add it to the database (by going to the admin panel and admin_pages). The page is pretty stripped of everything besides what is necessary.
It's on hastebin at http://hastebin.com/eyeramunam.xml
The gist of what you have to do is to use php's password_verify feature to see if what you have stored in the database matches what they entered. I used UserSpice's Input::get method to sanitize the data. So the checking logic is...
Note that this all assumes that the user is logged in already. If they're not logged in, it will throw up an error because there is no $user variable. If you need that ability, let me know and I'll see what I can do.
It's on hastebin at http://hastebin.com/eyeramunam.xml
The gist of what you have to do is to use php's password_verify feature to see if what you have stored in the database matches what they entered. I used UserSpice's Input::get method to sanitize the data. So the checking logic is...
Code:
<?php if(!empty($_POST)){
Code:
//I called the form field password
Code:
$password = Input::get('password');
Code:
//password_verify is a php thing and user->data is the userspice way of accessing user info
Code:
if(password_verify($password,$user->data()->password)){
Code:
//bold is a userspice function that is similar to echo but makes text easier to see on our dark backgrounds
Code:
bold("<br>The passwords match");
Code:
}else {
Code:
bold("<br>The passwords do not match");
Code:
}
Note that this all assumes that the user is logged in already. If they're not logged in, it will throw up an error because there is no $user variable. If you need that ability, let me know and I'll see what I can do.