}
    
    $thePassword = $wo->getPasswordHash($wo->cleanUserInput($value), $cUser['id']);
    	
    if ( $thePassword == FALSE ) {
    	echo "FAILED*****";
    }
    else {
    	$succ = $wo->db->query('update __users set loginPass=\''. $thePassword .'\' where id=\''. $cUser['id'] .'\'');
    	if ( $succ === FALSE ) {
    		echo "Failed to update: " . nl2br($wo->getErrorsAsStringAndClear()) ;
    	}
    	else {
    		$wo->db->commit();
    		echo "Ok";
    	}
    }
    */
    $checkPasswordValidity = true;
    $succ = WOOOF_User::changePassword($wo, $key, $value, $errors, '', $checkPasswordValidity);
    echo "{$key}: " . ($succ ? "changed OK" : "FAILED to change password") . "<br>";
    echo nl2br($wo->getErrorsAsStringAndClear());
    var_dump($errors);
    if ($succ) {
        $wo->db->commit();
    } else {
        $wo->db->rollback();
    }
    echo "<br>";
}
echo "Finished.";
Example #2
0
 /**
  *
  * @param WOOOF $wo
  * @param array $in
  * @return boolean
  */
 public static function passwordChange(WOOOF $wo, $in)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ChangePassword");
     $movieRamaPerson = $wo->db->getRowByColumn('v_movierama_persons', 'VUS_id', $in['movieRamaUserId']);
     if ($movieRamaPerson === FALSE) {
         return false;
     }
     if ($movieRamaPerson === NULL) {
         $wo->logError(self::_ECP . "3352 No MovieRama person found.");
         return false;
     }
     $user = $wo->db->getRow('__users', $movieRamaPerson['VUS_userId']);
     if ($user === FALSE) {
         return false;
     }
     if ($user === NULL) {
         $wo->logError(self::_ECP . "3357 No user found.");
         return false;
     }
     //change password here
     $passwordErrors = [];
     $res = WOOOF_User::changePassword($wo, $user['loginName'], $in['newPass'], $passwordErrors, $in['oldPass']);
     if ($res === FALSE) {
         return false;
     }
     return $res;
 }
 /**
  *
  * @param WOOOF $wo
  * @param array $in
  * @return boolean
  */
 public static function passwordReset(WOOOF $wo, $in)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ResetPassword");
     $userRec = $wo->db->getRowByColumn('__users', 'loginName', $in['email']);
     if ($userRec === FALSE) {
         return false;
     }
     if ($userRec === NULL) {
         $wo->logError(self::_ECP . "2360 No such user found.");
         return false;
     }
     //create new password here
     $newPassword = WOOOF::randomString(10);
     $newPassword[0] = 'A';
     $newPassword[1] = '1';
     //change password here
     $passwordErrors = [];
     $res = WOOOF_User::changePassword($wo, $in['email'], $newPassword, $passwordErrors);
     if ($res === FALSE) {
         return false;
     }
     //send the password to user via email
     $emailAddress = $in['email'];
     $subject = 'New MovieRama Password';
     $message = 'Your new MovieRama Password is: ' . $newPassword;
     $replyTo = '';
     $cc = '';
     $htmlMessage = 'Your new MovieRama Password is: ' . $newPassword;
     $files = null;
     $res = $wo->sendMail('', $emailAddress, $subject, $message, $replyTo, $cc, $htmlMessage, $files);
     return $res;
 }