Skip to content

Commit

Permalink
Merge pull request #300 from pisys/fix-special-at-ends
Browse files Browse the repository at this point in the history
add specialatends and show policy criticity check, fix german translation
  • Loading branch information
coudot authored May 15, 2019
2 parents afe75db + c00ca8f commit 31f60f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lang/de.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@
$messages['changesshkeysubject'] = "Ihr SSH-Schlüssel wurde geändert";
$messages['pwned'] = "Your new password has already been published on leaks, you should consider changing it on any other service that it is in use";
$messages['policypwned'] = "Your new password may not be published on any previous public password leak from any site";
$messages['specialatends'] = "Dein Passwort enthält das einzige Sonderzeichen am Anfang oder am Ende";
$messages['specialatends'] = "Ihr Passwort enthält das einzige Sonderzeichen am Anfang oder am Ende";
$messages['policyspecialatends'] = "Ein Sonderzeichen, wenn es nur ein einziges gibt, darf nicht am Anfang oder am Ende stehen";
6 changes: 3 additions & 3 deletions lib/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function generate_sms_token( $sms_token_length ) {
# Get message criticity
function get_criticity( $msg ) {

if ( preg_match( "/nophpldap|phpupgraderequired|nophpmhash|nokeyphrase|ldaperror|nomatch|badcredentials|passworderror|tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|answermoderror|answernomatch|mailnomatch|tokennotsent|tokennotvalid|notcomplex|smsnonumber|smscrypttokensrequired|nophpmbstring|nophpxml|smsnotsent|sameaslogin|pwned|sshkeyerror/" , $msg ) ) {
if ( preg_match( "/nophpldap|phpupgraderequired|nophpmhash|nokeyphrase|ldaperror|nomatch|badcredentials|passworderror|tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|answermoderror|answernomatch|mailnomatch|tokennotsent|tokennotvalid|notcomplex|smsnonumber|smscrypttokensrequired|nophpmbstring|nophpxml|smsnotsent|sameaslogin|pwned|sshkeyerror|specialatends/" , $msg ) ) {
return "danger";
}

Expand Down Expand Up @@ -174,7 +174,7 @@ function show_policy( $messages, $pwd_policy_config, $result ) {
# Should we display it?
if ( !$pwd_show_policy or $pwd_show_policy === "never" ) { return; }
if ( $pwd_show_policy === "onerror" ) {
if ( !preg_match( "/tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|notcomplex|sameaslogin|pwned/" , $result) ) { return; }
if ( !preg_match( "/tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|notcomplex|sameaslogin|pwned|specialatends/" , $result) ) { return; }
}

# Display bloc
Expand Down Expand Up @@ -593,4 +593,4 @@ function posthook_command($posthook, $login, $newpassword, $oldpassword = null,
}
}
return $command;
}
}

0 comments on commit 31f60f3

Please sign in to comment.