Преглед на файлове

feat: disable reg email send button after click

https://github.com/Anankke/SSPanel-Uim/issues/2363
M1Screw преди 1 година
родител
ревизия
9d668ace63
променени са 3 файла, в които са добавени 23 реда и са изтрити 21 реда
  1. 1 1
      resources/email/verify_code.tpl
  2. 18 20
      resources/views/tabler/auth/register.tpl
  3. 4 0
      resources/views/tabler/footer.tpl

+ 1 - 1
resources/email/verify_code.tpl

@@ -27,7 +27,7 @@
                             <p class="midText">
                                 你请求的邮箱验证代码为: <b style="color:#505050">{$code}</b> <br>
                                 本验证代码在 {$expire} 前有效。<br>
-                                如果此验证码非你本人所请求,请直接忽视。<br>
+                                如果此验证码非你本人申请,请忽视此邮件。<br>
                             </p>
                         </div>
                     </div>

+ 18 - 20
resources/views/tabler/auth/register.tpl

@@ -18,6 +18,18 @@
                     <div class="mb-3">
                         <input id="email" type="email" class="form-control" placeholder="电子邮箱">
                     </div>
+                    {if $public_setting['reg_email_verify']}
+                    <div class="mb-3">
+                        <div class="input-group mb-2">
+                            <input id="emailcode" type="text" class="form-control" placeholder="邮箱验证码">
+                            <button id="send-verify-email" class="btn text-blue" type="button"
+                                    hx-post="/auth/send" hx-swap="none" hx-disabled-elt="this"
+                                    hx-vals='js:{ email: document.getElementById("email").value }'>
+                                获取
+                            </button>
+                        </div>
+                    </div>
+                    {/if}
                     <div class="mb-3">
                         <div class="input-group input-group-flat">
                             <input id="password" type="password" class="form-control" placeholder="登录密码">
@@ -28,27 +40,13 @@
                             <input id="confirm_password" type="password" class="form-control" placeholder="重复登录密码">
                         </div>
                     </div>
-                    {if $public_setting['reg_mode'] !== 'close' }
-                        <div class="mb-3">
-                            <div class="input-group input-group-flat">
-                                <input id="invite_code" type="text" class="form-control"
-                                       placeholder="注册邀请码{if $public_setting['reg_mode'] === 'open'}(可选){else}(必填){/if}"
-                                       value="{$invite_code}">
-                            </div>
-                        </div>
-                    {/if}
-                    {if $public_setting['reg_email_verify']}
-                        <div class="mb-3">
-                            <div class="input-group mb-2">
-                                <input id="emailcode" type="text" class="form-control" placeholder="邮箱验证码">
-                                <button id="send-verify-email" class="btn text-blue" type="button"
-                                        hx-post="/auth/send" hx-swap="none"
-                                        hx-vals='js:{ email: document.getElementById("email").value }'>
-                                    获取
-                                </button>
-                            </div>
+                    <div class="mb-3">
+                        <div class="input-group input-group-flat">
+                            <input id="invite_code" type="text" class="form-control"
+                                   placeholder="注册邀请码{if $public_setting['reg_mode'] === 'open'}(可选){else}(必填){/if}"
+                                   value="{$invite_code}">
                         </div>
-                    {/if}
+                    </div>
                     <div class="mb-3">
                         <label class="form-check">
                             <input id="tos" type="checkbox" class="form-check-input"/>

+ 4 - 0
resources/views/tabler/footer.tpl

@@ -59,6 +59,10 @@
         let successDialog = new bootstrap.Modal(document.getElementById('success-dialog'));
         let failDialog = new bootstrap.Modal(document.getElementById('fail-dialog'));
 
+        if (evt.detail.elt.id === 'send-verify-email') {
+            document.getElementById('send-verify-email').disabled = true;
+        }
+
         if (res.ret === 1) {
             document.getElementById("success-message").innerHTML = res.msg;
             successDialog.show();