Exemplo n.º 1
0
 public function initiatePasswordReset()
 {
     $this->token_expiry_account_verify = Utility::getRandomString(32);
     $this->token_value_account_verify = Utility::getExpiryAsMySQLDateTime(new DateInterval("6 days"));
     $query = "UPDATE guardian SET token_expiry_account_verify = :te,\n\t\t\t\t\t  token_value_account_verify = :tv WHERE id = :id";
     $args = ["tv" => $this->token_expiry_account_verify, "te" => $this->token_value_account_verify, "id" => $this->id];
     $this->_pdo->perform($query, $args);
 }
Exemplo n.º 2
0
 private function logEmail(\bool $success, \string $template_name, User $to_user, array $data)
 {
     $query = "INSERT INTO email_log (user_id, template, vars, successful, view_key)\n\t\t\t\t\t  VALUES (:u, :t, :v, :s, :k)";
     $this->_pdo->perform($query, ["u" => $to_user->getId(), "t" => $template_name, "v" => serialize($data), "s" => $success, "k" => Utility::getRandomString(20)]);
 }
Exemplo n.º 3
0
 public function update()
 {
     $this->_pdo->perform("UPDATE remember SET token = :t, date_expires = :d WHERE id = :id", ["t" => $this->token = Utility::getRandomString(30), "d" => $this->date_expires = Utility::getExpiryAsMySQLDateTime(self::EXPIRE_TIME), "id" => $this->id]);
     $cookie_val = $this->getUser()->getEmailUniversity() . self::$COOKIE_SEPARATOR . $this->token;
     setcookie(self::$COOKIE_REMEMBER, $cookie_val, time() + Utility::SECONDS_IN_DAY * 30, "/");
 }
Exemplo n.º 4
0
 public function reissueVerificationToken()
 {
     $query = "UPDATE `user` SET token_expiry_account_verify = :te,\n\t\t\t\t\t  token_value_account_verify = :tv WHERE id = :id";
     $this->_pdo->perform($query, ["tv" => $this->token_expiry_account_verify = Utility::getRandomString(32), "te" => $this->token_value_account_verify = Utility::getExpiryAsMySQLDateTime("20 days"), "id" => $this->id]);
 }