541469799@qq.com il y a 1 an
Parent
commit
e522124b29

+ 1 - 1
app/index/controller/Captcha.php

@@ -72,7 +72,7 @@ class Captcha extends Controller
         $flag = $mailCaptcha->checkCaptcha($code, $mobile);
 
         if ($flag) {
-            return $this->renderSuccess('Sent Successful!Please check your new mails.');
+            return $this->renderSuccess('Successful.');
         }
         return $this->renderError('not match');
     }

+ 13 - 6
app/index/service/passport/MailCaptcha.php

@@ -34,6 +34,10 @@ class MailCaptcha extends BaseService
 
     // 发送限制间隔时间,默认24小时
     protected int $safeTime = 86400;
+    //验证码过期时间
+    protected int $expireTime = 300;
+    //可重复使用次数
+    protected int $checkTimes = 5;
 
     /**
      * 发送邮件验证码
@@ -64,7 +68,9 @@ class MailCaptcha extends BaseService
             return false;
         }
         // 生成验证码
-        $smsCaptcha = CaptchaApi::createSMS($email);
+        //$smsCaptcha = CaptchaApi::createSMS($email);
+        $smsCaptcha = (string)mt_rand(100000, 999999);
+        Cache::set("captchaSMS.{$email}", ['code' => $smsCaptcha, 'times' => $this->checkTimes], $this->expireTime);
 
         $mail = new PHPMailer(true);
         //dd(config('smtp'));
@@ -101,7 +107,7 @@ class MailCaptcha extends BaseService
             //Content
             //$mail->isHTML(true);                                  //Set email format to HTML
             $mail->Subject = 'Password';
-            $mail->Body = 'Your captcha is ' . $smsCaptcha['code'] . '.Please use it in 15 minutes';
+            $mail->Body = 'Your captcha is ' . $smsCaptcha . '.Please use it in 15 minutes';
             $mail->AltBody = 'This is the Your captcha for Free Shipping Vapes';
 
             $mail->send();
@@ -180,7 +186,7 @@ class MailCaptcha extends BaseService
         }
         // 判断发送次数是否合法
         if ($record['times'] <= 0) {
-            $this->error = '很抱歉,已超出今日最大发送次数限制';
+            $this->error = 'Sorry,up to the limit today.';
             return false;
         }
         // 发送次数递减
@@ -208,12 +214,13 @@ class MailCaptcha extends BaseService
 
     public function checkCaptcha($captchaCode = '', $email = '')
     {
-        if ($captchaCode == '888888') {
-            return true;
-        }
+//        if ($captchaCode == '888888') {
+//            return true;
+//        }
         $localCode = Cache::get('captchaSMS.' . $email);
         if (empty($localCode) || empty($localCode['code']) || $localCode['code'] != $captchaCode) {
             throwError('Sorry,your captcha is invalid');
         }
+        return true;
     }
 }

+ 1 - 1
app/index/view/base.html

@@ -237,7 +237,7 @@
                     </div>
                 </div>
                 <div class="footerIconContainer">
-                    <div>Contact Us:</div>
+                    <div>Click Here To Contact Us:</div>
                     <div class="footerIconList">
                         <a href=" https://wa.me/19252556104">
                             <div class="footerIconItem">

+ 1 - 1
app/index/view/passport/logIn.html

@@ -256,7 +256,7 @@
                         $("#emailVerifyModel").show(0).siblings().hide(0)
                         $("#emailAddress").text(email)
                     } else {
-                        showToast('Please try again later.')
+                        showToast(obj.message)
                     }
                 }
             })