Example #1
0
 /**
  * @param  string $current_password
  * @param  string $new_password
  * @return array
  */
 public function processPasswordChange($current_password, $new_password)
 {
     $rows = $this->db->select('users', array("`password` = '" . $current_password . "'", "`id` = '" . $this->id . "'"));
     $return_array = array();
     if (!$rows) {
         $return_array['status'] = 0;
         $return_array['message'] = 'Incorrect current password.';
     } else {
         $this->db->update('users', array('password' => $new_password), array("`id` = '" . $this->id . "'"));
         $return_array['status'] = 1;
         $return_array['message'] = 'New account password saved.';
     }
     return $return_array;
 }
 /**
  * @param  int $id
  * @return int
  */
 public function getIdFromUserId($user_id)
 {
     $rows = $this->db->select('businesses', array("`user_id` = '" . $user_id . "'"));
     if ($rows) {
         return $rows[0]['id'];
     }
 }
Example #3
0
 /**
  * Get the email from the account trying to reset their password based on
  * the forgot password token.
  *
  * @param string $token
  * @return string|boolean
  */
 public function getEmailFromForgotPasswordToken($token)
 {
     $rows = $this->db->select('forgot_password', array("`token` = '" . $token . "'"));
     return $rows ? $rows[0]['email'] : false;
 }