PHP Introduction to User Authentication in PHP Setting Up Authorization Password Hashing

Tamara McDiarmid
Tamara McDiarmid
4,351 Points

php login

Trying to validate that a user has entered valid password and matching passwords to change password.

index.php
<?php

function newPasswordValid($userPassword, $currentPassword, $newPassword, $confirmNewPassword) {
    //add code here
  if(password_verify($newPassword, $confirmedNewPassword) && password_verify($currentPassword,$userPassword)){
      return password_hash($newPassword,PASSWORD_DEFAULT);
  }else{return false;}
}