function __construct($version = 1.0, $app_id, $Lang) { $this->app_id = $app_id; $this->version = $version; $this->Lang = $Lang; parent::__construct(false); }
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(); }
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(); }
<?php $Form = new PerchForm('email', false); $Email = new PerchEmail('settings-test.html'); $req = array(); $req['email'] = "Required"; $Form->set_required($req); if ($Form->posted() && $Form->validate()) { $data = array(); $postvars = array('email'); $data = $Form->receive($postvars); if (PERCH_DEBUG) { $Email->SMTPDebug = 2; } //$Email->subject('Email settings test message'); $Email->recipientEmail($data['email']); $Email->senderName(PERCH_EMAIL_FROM_NAME); $Email->senderEmail(PERCH_EMAIL_FROM); if ($Email->send()) { $Alert->set('success', PerchLang::get('The email has been successfully sent.')); } else { $Alert->set('error', $Email->errors); } }