167167 .hpot {
168168 display: none;
169169 }
170+
171+ @keyframes shake {
172+ 0% {
173+ transform: translateX(0);
174+ }
175+
176+ 20% {
177+ transform: translateX(-12px);
178+ }
179+
180+ 40% {
181+ transform: translateX(12px);
182+ }
183+
184+ 60% {
185+ transform: translateX(-8px);
186+ }
187+
188+ 80% {
189+ transform: translateX(8px);
190+ }
191+
192+ 100% {
193+ transform: translateX(0);
194+ }
195+ }
196+
197+ #loginPanel.shake {
198+ animation: shake 0.45s ease;
199+ }
170200 </style>
171201
172202 <script type="text/javascript" src="/assets/js/jquery.min.js"></script>
206236
207237 ?>
208238 <div id="loginbox" style="margin-top:20px;margin-bottom:70px;float:right;margin-right:10px;" class="mainbox col-md-3 col-sm-8 ">
209- <div class="panel panel-default" style="opacity: 0.93;">
239+ <div class="panel panel-default" id="loginPanel" style="opacity: 0.93;">
210240 <div class="panel-heading">
211241 <div class="panel-title"><?= $ systemDisplayName ; ?> </div>
212242 </div>
@@ -291,6 +321,7 @@ function refreshIfIdle() {
291321 headers: window.additionalXHRParams
292322 });
293323
324+ const hasInitialAlert = <?= $ initialAlert ? 'true ' : 'false ' ; ?> ;
294325 let captchaflag = false;
295326
296327 function getCaptcha(captchaDivId) {
@@ -300,6 +331,16 @@ function getCaptcha(captchaDivId) {
300331 });
301332 }
302333
334+ function triggerShake() {
335+ const panel = document.getElementById('loginPanel');
336+ if (!panel) return;
337+ panel.classList.remove('shake');
338+ // Force reflow so removing the class resets the animation,
339+ // allowing repeated shakes.
340+ void panel.offsetWidth;
341+ panel.classList.add('shake');
342+ }
343+
303344 function validateNow() {
304345 flag = deforayValidator.init({
305346 formId: 'loginForm'
@@ -351,11 +392,15 @@ function(data) {
351392 <?php }
352393 if (isset ($ _SESSION ['alertMsg ' ]) && trim ((string ) $ _SESSION ['alertMsg ' ]) != "" ) { ?>
353394 alert("<?= $ _SESSION ['alertMsg ' ]; ?> ");
395+ triggerShake();
354396 <?php $ _SESSION ['alertMsg ' ] = '' ;
355397 unset($ _SESSION ['alertMsg ' ]);
356398 } ?>
357399
358400 checkLoginAttempts();
401+ if (hasInitialAlert) {
402+ triggerShake();
403+ }
359404 });
360405
361406
0 commit comments