Changeset 43
- Timestamp:
- Dec 18, 2005 12:38:31 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Auth_SQL.inc.php
r42 r43 12 12 define('AUTH_ENCRYPT_SHA1', 'sha1'); 13 13 define('AUTH_ENCRYPT_PLAINTEXT', 'plaintext'); 14 15 require_once dirname(__FILE__) . '/Email.inc.php'; 14 16 15 17 class Auth_SQL { … … 747 749 } 748 750 749 // Make sure user has an email on record. 751 // Get new password. 752 $password = $this->generatePassword(); 753 754 // Update password query. 755 $this->setPassword($user_id, $password); 756 757 // Make sure user has an email on record before continuing. 750 758 if (!isset($user_data['email']) || '' == trim($user_data['email'])) { 751 759 App::logMsg(sprintf('Password reset but notification failed, no email address for %s %s (%s).', $this->_auth, $user_data[$this->_params['db_primary_key']], $user_data[$this->_params['db_username_column']]), LOG_NOTICE, __FILE__, __LINE__); 752 } 753 754 // Get new password. 755 $password = $this->generatePassword(); 756 757 // Update password query. 758 $this->setPassword($user_id, $password); 759 760 // Body for email. 761 $email_body = <<<EOF 760 } else { 761 // Body for email. 762 $email_body = <<<EOF 762 763 Hello {NAME}, 763 764 … … 775 776 776 777 EOF; 777 778 $email = new Email(array(779 'to' => $user_data['email'],780 'from' => sprintf('%s <%s>', App::getParam('site_name'), App::getParam('site_email')),781 'subject' => sprintf('%s password change', App::getParam('site_name'))782 ));783 $email->setString($email_body);784 $email->replace(array(785 'site_name' => App::getParam('site_name'),786 'site_url' => App::getParam('site_url'),787 'name' => ('' != $user_data['first_name'] . $user_data['last_name'] ? $user_data['first_name'] . ' ' . $user_data['last_name'] : $user_data[$this->_params['db_username_column']]),788 'username' => $user_data[$this->_params['db_username_column']],789 'password' => $password,790 'reason' => $reason,791 ));792 $email->send();778 $email = new Email(array( 779 'to' => $user_data['email'], 780 'from' => sprintf('%s <%s>', App::getParam('site_name'), App::getParam('site_email')), 781 'subject' => sprintf('%s password change', App::getParam('site_name')) 782 )); 783 $email->setString($email_body); 784 $email->replace(array( 785 'site_name' => App::getParam('site_name'), 786 'site_url' => App::getParam('site_url'), 787 'name' => ('' != $user_data['first_name'] . $user_data['last_name'] ? $user_data['first_name'] . ' ' . $user_data['last_name'] : $user_data[$this->_params['db_username_column']]), 788 'username' => $user_data[$this->_params['db_username_column']], 789 'password' => $password, 790 'reason' => $reason, 791 )); 792 $email->send(); 793 } 793 794 794 795 return array( -
trunk/lib/Email.inc.php
r42 r43 226 226 227 227 // Ensure required values exist. 228 if (!isset($this->_template)) { 229 App::logMsg(sprintf('Cannot send email. Template not set.', null), LOG_ERR, __FILE__, __LINE__); 228 if (!isset($this->_params['subject'])) { 229 App::logMsg(sprintf('Cannot send email to %s. SUBJECT not defined.', $this->_params['to']), LOG_ERR, __FILE__, __LINE__); 230 return false; 231 } else if (!isset($this->_template)) { 232 App::logMsg(sprintf('Cannot send email: "%s". Template not set.', $this->_params['subject']), LOG_ERR, __FILE__, __LINE__); 230 233 return false; 231 234 } else if (!isset($this->_params['to'])) { 232 App::logMsg(sprintf('Cannot send email . TO not defined.', null), LOG_ERR, __FILE__, __LINE__);235 App::logMsg(sprintf('Cannot send email: "%s". TO not defined.', $this->_params['subject']), LOG_NOTICE, __FILE__, __LINE__); 233 236 return false; 234 237 } else if (!isset($this->_params['from'])) { 235 App::logMsg(sprintf('Cannot send email. FROM not defined.', null), LOG_ERR, __FILE__, __LINE__); 236 return false; 237 } else if (!isset($this->_params['subject'])) { 238 App::logMsg(sprintf('Cannot send email. SUBJECT not defined.', null), LOG_ERR, __FILE__, __LINE__); 238 App::logMsg(sprintf('Cannot send email: "%s". FROM not defined.', $this->_params['subject']), LOG_ERR, __FILE__, __LINE__); 239 239 return false; 240 240 } -
trunk/tests/_config.inc.php
r42 r43 27 27 'log_filename' => 'codebase_test_log', 28 28 'log_file_priority' => LOG_DEBUG, 29 'log_screen_priority' => LOG_ INFO,29 'log_screen_priority' => LOG_WARNING, 30 30 'error_reporting' => E_ALL, 31 31 ));
Note: See TracChangeset
for help on using the changeset viewer.