Example #1
0
 /**
  * Passwort für Benutzer zurücksetzten
  * @param bool $resetOnly (@since FPCM3.4)
  * @return boolean
  */
 public function resetPassword($resetOnly = false)
 {
     $this->disablePasswordSecCheck();
     $password = substr(str_shuffle(ucfirst(sha1($this->username) . uniqid())), 0, rand(10, 16));
     $this->salt = \fpcm\classes\security::createSalt($this->displayname . '-' . $this->username . '-' . $this->id);
     $this->passwd = \fpcm\classes\security::createPasswordHash($password, $this->salt);
     if ($resetOnly) {
         return array('updateOk' => $this->update(), 'password' => $password);
     }
     $text = $this->language->translate('PASSWORD_RESET_TEXT', array('{{newpass}}' => $password));
     $email = new \fpcm\classes\email($this->email, $this->language->translate('PASSWORD_RESET_SUBJECT'), $text);
     $email->setHtml(true);
     if ($email->submit()) {
         return $this->update();
     }
     return false;
 }