commit 33d5e19: [WebUI] Fix login modal

moisseev moiseev at mezonplus.ru
Thu Jul 9 23:07:06 UTC 2020


Author: moisseev
Date: 2020-07-09 17:50:51 +0300
URL: https://github.com/rspamd/rspamd/commit/33d5e19ab13af3740060b5f9077a7ed38c6ea8da (refs/pull/3427/head)

[WebUI] Fix login modal

---
 interface/index.html       |  7 +++----
 interface/js/app/rspamd.js | 17 ++++++++---------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/interface/index.html b/interface/index.html
index 3b2f1f2ca..f23567191 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -471,11 +471,11 @@
 </div>
 
 <!-- login modal -->
-<div id="connectDialog" class="modal" tabindex="-1" role="dialog" style="display: none;">
+<div id="connectDialog" class="modal fade" data-backdrop="static" data-keyboard="false" role="dialog">
 	<div class="modal-dialog modal-sm modal-dialog-centered">
 		<div class="modal-content shadow">
-			<div class="modal-header py-2">
-				<h6 class="modal-title">Login to Rspamd</h6>
+			<div class="modal-header text-secondary py-2">
+				<i class="fas fa-key my-auto"></i><h6 class="modal-title font-weight-bolder">Login to Rspamd</h6>
 			</div>
 			<div class="modal-body" id="connectBody">
 				<form id="connectForm">
@@ -497,7 +497,6 @@
 	</div>
 </div>
 
-<div id="backDrop" class="modal-backdrop fade in" style="display: none;"></div>
 <script data-main="./js/main.js" src="./js/lib/require.min.js"></script>
 </body>
 </html>
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index e48a75318..be7594e30 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -452,13 +452,12 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
                 displayUI();
             },
             error: function () {
-                var dialog = $("#connectDialog");
-                var backdrop = $("#backDrop");
-                $("#mainUI").hide();
-                $(dialog).show();
-                $(backdrop).show();
-                $("#connectPassword").focus();
-                $("#connectForm").off("submit");
+                $("#connectDialog")
+                    .on("shown.bs.modal", function () {
+                        $("#connectDialog").off("shown.bs.modal");
+                        $("#connectPassword").focus();
+                    })
+                    .modal("show");
 
                 $("#connectForm").on("submit", function (e) {
                     e.preventDefault();
@@ -479,8 +478,8 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_
                             if (data.auth === "ok") {
                                 sessionStorage.setItem("read_only", data.read_only);
                                 saveCredentials(password);
-                                $(dialog).hide();
-                                $(backdrop).hide();
+                                $("#connectForm").off("submit");
+                                $("#connectDialog").modal("hide");
                                 displayUI();
                             }
                         },


More information about the Commits mailing list