コード例 #1
0
ファイル: Login_0.php プロジェクト: 62BRAINS/EPESI
 public function submit_recover($data)
 {
     $mail = $data['mail'];
     $username = $data['username'];
     if (DEMO_MODE && $username == 'admin') {
         print 'In demo you cannot recover \'admin\' user password. If you want to login please type \'admin\' as password.';
         return false;
     }
     $user_id = Base_UserCommon::get_user_id($username);
     DB::Execute('DELETE FROM user_reset_pass WHERE created_on<%T', array(time() - 3600 * 2));
     if ($user_id === false) {
         print 'No such user!';
         return false;
     }
     $hash = md5($user_id . '' . time());
     DB::Execute('INSERT INTO user_reset_pass(user_login_id,hash_id,created_on) VALUES (%d,%s,%T)', array($user_id, $hash, time()));
     $subject = __('Password recovery');
     $message = __('A password recovery for the account with the e-mail address %s has been requested.', array($mail)) . "\n\n" . __('If you want to reset your password, visit the following URL:') . "\n" . get_epesi_url() . '/modules/Base/User/Login/reset_pass.php?hash=' . $hash . "\n" . __('or just ignore this message and your login and password will remain unchanged.') . "\n\n" . __('If you did not use the Password Recovery form, inform your administrator about a potential unauthorized attempt to login using your credentials.') . "\n\n" . __('This e-mail was generated automatically and you do not need to respond to it.');
     $sendMail = Base_MailCommon::send_critical($mail, $subject, $message);
     return true;
 }
コード例 #2
0
ファイル: LoginCommon_0.php プロジェクト: cretzu89/EPESI
 /**
  * Send mail with login and password to address....
  * 
  * @param string username
  * @param string password
  * @param string destination mail address
  */
 public static function send_mail_with_password($username, $pass, $mail, $recovery = false)
 {
     $url = get_epesi_url();
     $subject = __('Your account at %s', array($url));
     $header = Variable::get('add_user_email_header', '');
     $body = $header ? $header . "\n\n" : '';
     if ($recovery) {
         $body .= __('This e-mail is to inform you that your password at %s has been reset.', array($url));
     } else {
         $body .= __('This e-mail is to inform you that a user account was setup for you at: %s.', array($url));
     }
     $body .= "\n" . __('Your username is: %s', array($username)) . "\n" . __('Your password is: %s', array($pass)) . "\n\n" . __('For security reasons it is recommened that you log in immediately and change your password.') . "\n\n" . __('This e-mail was generated automatically and you do not need to respond to it.');
     return Base_MailCommon::send_critical($mail, $subject, $body);
 }