Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several tweaks we always do manually #321

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
# above - the form
# below - the form
$pwd_show_policy_pos = "above";
# Use statically formulated policy
# instead of dynamically generated one
#$pwd_static_policy = "conf/policy.inc.html";

# disallow use of the only special character as defined in `$pwd_special_chars` at the beginning and end
$pwd_no_special_at_ends = false;
Expand Down Expand Up @@ -222,6 +225,8 @@
$sms_attribute = "mobile";
# Partially hide number
$sms_partially_hide_number = true;
# Display full name
$sms_display_full_name = true;
# Send SMS mail to address
$smsmailto = "{sms_attribute}@service.provider.com";
# Subject when sending email to SMTP to SMS provider
Expand Down
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"pwd_no_reuse" => $pwd_no_reuse,
"pwd_diff_login" => $pwd_diff_login,
"pwd_complexity" => $pwd_complexity,
"pwd_static_policy" => $pwd_static_policy,
"use_pwnedpasswords" => $use_pwnedpasswords,
"pwd_no_special_at_ends" => $pwd_no_special_at_ends
);
Expand Down
34 changes: 22 additions & 12 deletions lib/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,32 @@ function show_policy( $messages, $pwd_policy_config, $result ) {
if ( !preg_match( "/tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|notcomplex|sameaslogin|pwned|specialatends/" , $result) ) { return; }
}

if ( isset( $pwd_static_policy ) ) {
$fp = fopen ($pwd_static_policy, 'rb');
} else {
$fp = FALSE;
}

# Display bloc
echo "<div class=\"help alert alert-warning\">\n";
echo "<p>".$messages["policy"]."</p>\n";
echo "<ul>\n";
if ( $pwd_min_length ) { echo "<li>".$messages["policyminlength"] ." $pwd_min_length</li>\n"; }
if ( $pwd_max_length ) { echo "<li>".$messages["policymaxlength"] ." $pwd_max_length</li>\n"; }
if ( $pwd_min_lower ) { echo "<li>".$messages["policyminlower"] ." $pwd_min_lower</li>\n"; }
if ( $pwd_min_upper ) { echo "<li>".$messages["policyminupper"] ." $pwd_min_upper</li>\n"; }
if ( $pwd_min_digit ) { echo "<li>".$messages["policymindigit"] ." $pwd_min_digit</li>\n"; }
if ( $pwd_min_special ) { echo "<li>".$messages["policyminspecial"] ." $pwd_min_special</li>\n"; }
if ( $pwd_complexity ) { echo "<li>".$messages["policycomplex"] ." $pwd_complexity</li>\n"; }
if ( $pwd_forbidden_chars ) { echo "<li>".$messages["policyforbiddenchars"] ." $pwd_forbidden_chars</li>\n"; }
if ( $pwd_no_reuse ) { echo "<li>".$messages["policynoreuse"] ."\n"; }
if ( $pwd_diff_login ) { echo "<li>".$messages["policydifflogin"] ."\n"; }
if ( $use_pwnedpasswords ) { echo "<li>".$messages["policypwned"] ."\n"; }
if ( $pwd_no_special_at_ends ) { echo "<li>".$messages["policyspecialatends"] ."</li>\n"; }
if ($fp) {
fpassthru($fp);
} else {
if ( $pwd_min_length ) { echo "<li>".$messages["policyminlength"] ." $pwd_min_length</li>\n"; }
if ( $pwd_max_length ) { echo "<li>".$messages["policymaxlength"] ." $pwd_max_length</li>\n"; }
if ( $pwd_min_lower ) { echo "<li>".$messages["policyminlower"] ." $pwd_min_lower</li>\n"; }
if ( $pwd_min_upper ) { echo "<li>".$messages["policyminupper"] ." $pwd_min_upper</li>\n"; }
if ( $pwd_min_digit ) { echo "<li>".$messages["policymindigit"] ." $pwd_min_digit</li>\n"; }
if ( $pwd_min_special ) { echo "<li>".$messages["policyminspecial"] ." $pwd_min_special</li>\n"; }
if ( $pwd_complexity ) { echo "<li>".$messages["policycomplex"] ." $pwd_complexity</li>\n"; }
if ( $pwd_forbidden_chars ) { echo "<li>".$messages["policyforbiddenchars"] ." $pwd_forbidden_chars</li>\n"; }
if ( $pwd_no_reuse ) { echo "<li>".$messages["policynoreuse"] ."\n"; }
if ( $pwd_diff_login ) { echo "<li>".$messages["policydifflogin"] ."\n"; }
if ( $use_pwnedpasswords ) { echo "<li>".$messages["policypwned"] ."\n"; }
if ( $pwd_no_special_at_ends ) { echo "<li>".$messages["policyspecialatends"] ."</li>\n"; }
}
echo "</ul>\n";
echo "</div>\n";
}
Expand Down
12 changes: 7 additions & 5 deletions pages/sendsms.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,14 @@

<div class="alert alert-info">
<form action="#" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-sm-4 control-label"><?php echo $messages["userfullname"]; ?></label>
<div class="col-sm-8">
<p class="form-control-static"><?php echo $displayname[0]; ?></p>
<?php if ($sms_display_full_name) { ?>
<div class="form-group">
<label class="col-sm-4 control-label"><?php echo $messages["userfullname"]; ?></label>
<div class="col-sm-8">
<p class="form-control-static"><?php echo $displayname[0]; ?></p>
</div>
</div>
</div>
<?php } ?>
<div class="form-group">
<label class="col-sm-4 control-label"><?php echo $messages["login"]; ?></label>
<div class="col-sm-8">
Expand Down
4 changes: 4 additions & 0 deletions pages/sendtoken.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@
$server_port = $_SERVER['SERVER_PORT'];
$script_name = $_SERVER['SCRIPT_NAME'];

# Handle being behind revproxy
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https" ) { $method .= "s"; }
if ( isset($_SERVER['HTTP_X_FORWARDED_PORT']) ) { $server_port = $_SERVER['HTTP_X_FORWARDED_PORT']; }

# Force server port if non standard port
if ( ( $method === "http" and $server_port != "80" )
or ( $method === "https" and $server_port != "443" )
Expand Down