Browse Source

验证输入内容

luolongf 3 years ago
parent
commit
46c28126f1
1 changed files with 14 additions and 1 deletions
  1. 14 1
      heroku/web/index.php

+ 14 - 1
heroku/web/index.php

@@ -158,9 +158,22 @@ $VERIFIED = $FF_TOKEN === getenv('FF_TOKEN');
                 </div>
             </div>
             <script>
-                document.getElementById('submit-btn').onclick = function () {
+                let submitBtn = document.getElementById('submit-btn');
+
+                submitBtn.onclick = function () {
                     let ffToken = document.getElementById('pwd').value;
 
+                    ffToken = ffToken.replace(/\s/g, '');
+
+                    if (ffToken.length < 1) {
+                        mdui.snackbar({message: '请输入令牌'});
+
+                        return;
+                    }
+
+                    submitBtn.disabled = true;
+                    submitBtn.innerText = '送信中...';
+
                     window.location.href = '?ff-token=' + ffToken;
                 }
             </script>