Skip to content

Commit

Permalink
allow to select login field according to component (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur committed Sep 11, 2024
1 parent 68652c1 commit 7bb983d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/ppolicy/js/ppolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

ltbComponent = $("#ltb-component").text();
entropyPath = new Map([["ssp", "?action=checkentropy"], ["sd", "?page=checkentropy"]]);
loginField = new Map([["ssp", "#login"], ["sd", "#info_identifier td"]]);

bootstrapClasses = new Map([["Err", "bg-danger"], ["0", "bg-danger"], ["1", "bg-warning"], ["2", "bg-info"], ["3", "bg-primary"], ["4", "bg-success"]]);

Expand Down Expand Up @@ -195,9 +196,17 @@
}

if (local_policy.pwd_diff_login && local_policy.pwd_diff_login == true) {
if( $( "#login" ).length )
loginElement = $( loginField.get(ltbComponent) );
if(loginElement.is("input"))
{
login = loginElement.val().trim();
}
else
{
login = loginElement.text().trim();
}
if( login.length )
{
login = $( "#login" ).val();
report( password != login, 'ppolicy-pwd_diff_login-feedback');
}
else
Expand Down

0 comments on commit 7bb983d

Please sign in to comment.