Exemple #1
0
 public static function generateRandomPasswordLinkKey()
 {
     return ClassTools::generateRandomPasswd(60, array('1', '2', '3'));
 }
Exemple #2
0
 public static function generateNewPassword($ajaxData)
 {
     return ClassTools::generateRandomPasswd();
 }
Exemple #3
0
 public function sendNewPassword($password_key)
 {
     // sprawdzanie kiedy ostatnio zostal wyslany link do zmiany hasla
     if (!($last_send = $this->sqlGetWhenPasswordSendByPasswordKey($password_key))) {
         $this->errors = "Niepoprawny link.";
         return false;
     }
     $date_password_send = new DateTime($last_send['date_send']);
     $date_now = new DateTime("now");
     $date_now->sub(new DateInterval('PT' . ClassAuth::$password_link_time . 'H'));
     // print_r($date_now);
     if ($date_password_send < $date_now) {
         $this->errors = "Link jest nieaktywny.";
         return false;
     }
     // generowanie nowego hasla
     $new_password = ClassTools::generateRandomPasswd();
     if (!($user = new ClassUser($last_send['id_user']))) {
         $this->errors = $user->errors;
         return false;
     }
     if (!$user->sqlUpdatePassword($new_password, $last_send['id_user_new_password'])) {
         $this->errors = $user->errors;
         return false;
     }
     $this->auth_user = $user;
     return $new_password;
 }