예제 #1
0
 /**
  * Perform user initiated password reset using the given token
  * @param $result
  * @return mixed
  */
 public function doPasswordReset($result)
 {
     // validate input + additional validation
     $jsonval = new JsonValidate($this->data, '{"pass":"", "token":""}');
     if (($errors = $jsonval->validate()) !== true) {
         $result['error'] = $errors;
         return $result;
     }
     $custMdl = new CustomerModel();
     $tokres = $custMdl->tokenReset($this->data->token, $this->data->pass);
     if ($tokres === 0) {
         $result['error'] = "Failed to reset password using the given token\nThe token may have expired.";
     } else {
         if ($tokres === false) {
             $result['error'] = "Failed to update your password: " . $custMdl->errorInfo;
         }
     }
     return $result;
 }