Переглянути джерело

make sure prefix is not empty before submitting

Son NK 5 роки тому
батько
коміт
e704497b0f
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      app/dashboard/templates/dashboard/custom_alias.html

+ 7 - 0
app/dashboard/templates/dashboard/custom_alias.html

@@ -28,6 +28,7 @@
       <div class="row mb-2">
       <div class="row mb-2">
         <div class="col-sm-6 mb-1 p-1" style="min-width: 4em">
         <div class="col-sm-6 mb-1 p-1" style="min-width: 4em">
           <input name="prefix" class="form-control"
           <input name="prefix" class="form-control"
+                 id="prefix"
                  type="text"
                  type="text"
                  pattern="[0-9a-z-_]{1,}"
                  pattern="[0-9a-z-_]{1,}"
                  title="Only lowercase letter, number, dash (-), underscore (_) can be used in alias prefix."
                  title="Only lowercase letter, number, dash (-), underscore (_) can be used in alias prefix."
@@ -95,12 +96,18 @@
     $("#submit").on("click", async function () {
     $("#submit").on("click", async function () {
       let that = $(this);
       let that = $(this);
       let mailbox_ids = $(`#mailboxes`).val();
       let mailbox_ids = $(`#mailboxes`).val();
+      let prefix = $('#prefix').val();
 
 
       if (mailbox_ids.length == 0) {
       if (mailbox_ids.length == 0) {
         toastr.error("You must select at least a mailbox", "Error");
         toastr.error("You must select at least a mailbox", "Error");
         return;
         return;
       }
       }
 
 
+      if (!prefix) {
+        toastr.error("Alias cannot be empty", "Error");
+        return;
+      }
+
       that.closest("form").submit();
       that.closest("form").submit();
 
 
     })
     })