Browse Source

php - fix user/pass character checking

master
kanoi 10 years ago
parent
commit
bbd8676862
  1. 8
      pool/page_reg.php

8
pool/page_reg.php

@ -59,7 +59,7 @@ function safepass($pass)
return false; return false;
# Invalid characters # Invalid characters
$p2 = preg_replace('/[^ -~]/', '', $pass); $p2 = preg_replace('/[\011]/', '', $pass);
if ($p2 != $pass) if ($p2 != $pass)
return false; return false;
@ -109,7 +109,7 @@ function show_reg($menu, $name, $u)
{ {
$ok = false; $ok = false;
$data['error'] = "Password is unsafe - requires 6 or more characters, including<br>" . $data['error'] = "Password is unsafe - requires 6 or more characters, including<br>" .
"at least one of each uppercase, lowercase and digits"; "at least one of each uppercase, lowercase and digits, but not Tab";
} }
elseif ($pass2 != $pass) elseif ($pass2 != $pass)
{ {
@ -118,11 +118,11 @@ function show_reg($menu, $name, $u)
} }
$orig = $user; $orig = $user;
$user = preg_replace('/[_\\.]/', '', $orig); $user = preg_replace('/[\._\/\011]/', '', $orig);
if ($user != $orig) if ($user != $orig)
{ {
$ok = false; $ok = false;
$data['error'] = "Username cannot include '.' or '_'"; $data['error'] = "Username cannot include '.', '_', '/' or Tab";
$data['user'] = $user; $data['user'] = $user;
} }
} }

Loading…
Cancel
Save