Skip to content

Commit cf1681f

Browse files
Fix the Password Focus on Edge/Chrome
Minor Fixes to Fix the Invalid Password Focus on Edge/Chrome Currently on Edge/Chrome; even when the password is validated; the user is unable to click elsewhere like to change the postpone period. This fixes that issue.
1 parent 38a3721 commit cf1681f

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

MerlinAU.asp

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,9 @@ const loginPassword =
11191119
}
11201120
this.pswdStr = pswdStr;
11211121
this.pswdLen = pswdStr.length;
1122-
if (this.pswdInvalid || this.pswdVerified || this.pswdUnverified ||
1123-
this.pswdLen < this.minLen || this.pswdLen > this.maxLen ||
1124-
this.pswdStr.match (`${this.allBlankCharsRegExp}`) !== null)
1122+
if ( this.pswdInvalid ||
1123+
this.pswdLen < this.minLen || this.pswdLen > this.maxLen ||
1124+
this.pswdStr.match(this.allBlankCharsRegExp) !== null )
11251125
{ return false; }
11261126
else
11271127
{ return true; }
@@ -1133,6 +1133,20 @@ const loginPassword =
11331133
/**----------------------------------------**/
11341134
function ValidatePasswordString (formField, eventID)
11351135
{
1136+
// clear old server invalid flag as soon as they type
1137+
if (eventID === 'onKEYUP') { loginPassword.pswdInvalid = false; }
1138+
1139+
// if the server has already said “invalid,” keep it red
1140+
if (loginPassword.pswdInvalid)
1141+
{
1142+
formField.focus();
1143+
$(formField).addClass('Invalid');
1144+
$(formField).off('mouseover');
1145+
$(formField).on('mouseover',function(){return overlib(loginPassword.ErrorHint(),0,0);});
1146+
$(formField)[0].onmouseout = nd;
1147+
return false;
1148+
}
1149+
11361150
if (loginPassword.ValidateString(formField, eventID))
11371151
{
11381152
$(formField).removeClass('Invalid');
@@ -1141,18 +1155,12 @@ function ValidatePasswordString (formField, eventID)
11411155
}
11421156
else
11431157
{
1144-
let retStatus;
1145-
if (loginPassword.pswdVerified || loginPassword.pswdUnverified)
1146-
{ retStatus = true; }
1147-
else
1148-
{
1149-
retStatus = false;
1150-
$(formField).addClass('Invalid');
1151-
}
1158+
$(formField).addClass('Invalid');
11521159
formField.focus();
1160+
$(formField).off('mouseover');
11531161
$(formField).on('mouseover',function(){return overlib(loginPassword.ErrorHint(),0,0);});
11541162
$(formField)[0].onmouseout = nd;
1155-
return retStatus;
1163+
return false;
11561164
}
11571165
}
11581166
@@ -1506,11 +1514,12 @@ function GetLoginPswdCheckStatus()
15061514
loginPassword.pswdUnverified = true;
15071515
break;
15081516
case 5: //Failure//
1517+
// mark invalid and only steal focus on real failure
1518+
loginPassword.pswdInvalid = true;
15091519
passwordFailed = true;
15101520
pswdStatusText = 'Status:\n' + loginPswdCheckMsgStr;
15111521
pswdStatusHint0 = loginPswdInvalidHint;
15121522
pswdStatusHint1 = loginPswdInvalidHint;
1513-
loginPassword.pswdInvalid = true;
15141523
break;
15151524
case 6: //Unknown//
15161525
pswdStatusText = 'Status:\n' + loginPswdCheckMsgStr;
@@ -1526,15 +1535,14 @@ function GetLoginPswdCheckStatus()
15261535
loginPswdHint = loginPswdHint.replace (/PswdSTATUS/, pswdStatusHint1);
15271536
15281537
pswdField = document.getElementById('routerPassword');
1529-
if (passwordFailed || pswdVerified || pswdUnverified)
1538+
1539+
// only refocus when passwordFailed is true
1540+
if (passwordFailed)
15301541
{
1531-
if (passwordFailed)
1532-
{
1533-
alert(`**ERROR**\n${loginPswdInvalidMsge}`);
1534-
$(pswdField).addClass('Invalid');
1535-
}
1542+
alert(`**ERROR**\n${loginPswdInvalidMsge}`);
1543+
$(pswdField).addClass('Invalid');
15361544
pswdField.focus();
1537-
$(pswdField).on('mouseover',function(){return overlib(pswdStatusHint0,0,0);});
1545+
$(pswdField).on('mouseover',function(){return overlib(loginPassword.ErrorHint(),0,0);});
15381546
$(pswdField)[0].onmouseout = nd;
15391547
}
15401548
else

0 commit comments

Comments
 (0)