public function reset_pwd_and_notify()
 {
     $new_password = PerchUser::generate_password();
     $data = array();
     // check which type of password - default is portable
     if (defined('PERCH_NONPORTABLE_HASHES') && PERCH_NONPORTABLE_HASHES) {
         $portable_hashes = false;
     } else {
         $portable_hashes = true;
     }
     $Hasher = new PasswordHash(8, $portable_hashes);
     $data['userPassword'] = $Hasher->HashPassword($new_password);
     $this->update($data);
     $Email = new PerchEmail('password-reset.html');
     //$Email->subject('Your CMS password has been reset');
     $Email->recipientEmail($this->userEmail());
     $Email->senderName(PERCH_EMAIL_FROM_NAME);
     $Email->senderEmail(PERCH_EMAIL_FROM);
     $Email->set('username', $this->userUsername());
     $Email->set('password', $new_password);
     $Email->set('givenname', $this->userGivenName());
     $Email->set('familyname', $this->userFamilyName());
     $Email->set('sendername', PERCH_EMAIL_FROM_NAME);
     $Email->set('url', 'http://' . $_SERVER['HTTP_HOST'] . PERCH_LOGINPATH);
     return $Email->send();
 }
Exemplo n.º 2
0
 public function reset_pwd_and_notify()
 {
     $new_password = PerchUser::generate_password();
     $data = array();
     $Hasher = PerchUtil::get_password_hasher();
     $data['userPassword'] = $Hasher->HashPassword($new_password);
     $this->update($data);
     $Email = new PerchEmail('password-reset.html');
     //$Email->subject('Your CMS password has been reset');
     $Email->recipientEmail($this->userEmail());
     $Email->senderName(PERCH_EMAIL_FROM_NAME);
     $Email->senderEmail(PERCH_EMAIL_FROM);
     $Email->set('username', $this->userUsername());
     $Email->set('password', $new_password);
     $Email->set('givenname', $this->userGivenName());
     $Email->set('familyname', $this->userFamilyName());
     $Email->set('sendername', PERCH_EMAIL_FROM_NAME);
     $Email->set('url', 'http://' . $_SERVER['HTTP_HOST'] . PERCH_LOGINPATH);
     return $Email->send();
 }