The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validating Password (while already logged on)
#4
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...

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.
  Reply


Messages In This Thread
Validating Password (while already logged on) - by mudmin - 04-17-2016, 01:53 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)