Skip to content

Commit

Permalink
fix Password policy javascript checker when oldpassword is not displa…
Browse files Browse the repository at this point in the history
…yed in the form (ltb-project#854)
  • Loading branch information
David Coutadeur committed Mar 11, 2024
1 parent e5f9c38 commit 765aae9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions htdocs/js/ppolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}

if (window.policy.pwd_no_reuse && window.policy.pwd_no_reuse == true) {
if( $( "#oldpassword" ) )
if( $( "#oldpassword" ).length )
{
oldpassword = $( "#oldpassword" ).val();
report( password != oldpassword , 'ppolicy-pwd_no_reuse-feedback');
Expand All @@ -112,7 +112,7 @@
}

if (window.policy.pwd_diff_login && window.policy.pwd_diff_login == true) {
if( $( "#login" ) )
if( $( "#login" ).length )
{
login = $( "#login" ).val();
report( password != login, 'ppolicy-pwd_diff_login-feedback');
Expand All @@ -124,7 +124,7 @@
}

if (window.policy.pwd_diff_last_min_chars > 0) {
if( $( "#oldpassword" ) && $( "#oldpassword" ).val().length > 0 && password.length > 0 )
if( $( "#oldpassword" ).length && $( "#oldpassword" ).val().length > 0 && password.length > 0 )
{
minDiffChars = window.policy.pwd_diff_last_min_chars;
oldpassword = $( "#oldpassword" ).val();
Expand Down

0 comments on commit 765aae9

Please sign in to comment.