diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index 1e15d72e..b1dbb099 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -138,7 +138,7 @@ class AuthController extends BaseController $url = Option::get('site_url')."/auth/reset?uid={$uid}&token=$token"; $content = View::make('auth.mail')->with('reset_url', $url)->render(); - if(!$mail->Send($content)) { + if(!$mail->content($content)->send()) { View::json('邮件发送失败,详细信息:'.$mail->getLastError(), 2); } else { $_SESSION['last_mail_time'] = time(); diff --git a/app/Services/Mail.php b/app/Services/Mail.php index 6c440b43..d31c78fe 100644 --- a/app/Services/Mail.php +++ b/app/Services/Mail.php @@ -55,17 +55,20 @@ class Mail return $this->mailer->ErrorInfo; } + public function content($content) + { + $this->mail->isHTML(true); + $this->mail->Body = $content; + return $this; + } + /** * Send a mail * - * @param string $body * @return boolean */ - public function send($body) + public function send() { - $this->mail->isHTML(true); - $this->mail->Body = $body; - return $this->mail->send(); } diff --git a/assets/src/js/auth.js b/assets/src/js/auth.js index 2630e793..eb980d49 100644 --- a/assets/src/js/auth.js +++ b/assets/src/js/auth.js @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-07-17 10:54:22 * @Last Modified by: printempw - * @Last Modified time: 2016-07-27 18:18:16 + * @Last Modified time: 2016-07-28 15:44:31 */ 'use strict'; @@ -84,9 +84,7 @@ $('#login-button').click(function() { return false; }); -$('.captcha').click(function() { - $(this).attr('src', './captcha?' + new Date().getTime()); -}); +$('.captcha').click(freshCaptcha); $('#register-button').click(function() { @@ -180,9 +178,10 @@ $('#forgot-button').click(function() { success: function(json) { if (json.errno == 0) { showMsg(json.msg, 'success'); - $('#forgot-button').html('发送').prop('disabled', ''); + $('#forgot-button').html('发送').prop('disabled', 'disabled'); } else { showMsg(json.msg, 'warning'); + freshCaptcha(); $('#forgot-button').html('发送').prop('disabled', ''); } },