mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Fix the username validator
This commit is contained in:
parent
0d88619edb
commit
59183064da
1 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ if (isset($_GET['action'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _valid_user($name) {
|
function _valid_user($name) {
|
||||||
return ( bool ) ! preg_match( '/^[a-z0-9@_.-]+$/i' , $name );
|
return ( bool ) preg_match( "/^[a-z0-9@_.-]+$/i" , $name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ if ($action == "list") {
|
||||||
_jtable_respond($users);
|
_jtable_respond($users);
|
||||||
} elseif ($action == "create" or $action == "update") {
|
} elseif ($action == "create" or $action == "update") {
|
||||||
if (_valid_user($_POST['emailaddress']) === FALSE) {
|
if (_valid_user($_POST['emailaddress']) === FALSE) {
|
||||||
_jtable_respond(null, 'error', "Please only use [a-z0-9@_/.-] for usernames");
|
_jtable_respond(null, 'error', "Please only use ^[a-z0-9@_.-]+$ for usernames");
|
||||||
}
|
}
|
||||||
$isadmin = $_POST['isadmin'] ? $_POST['isadmin'] : '0';
|
$isadmin = $_POST['isadmin'] ? $_POST['isadmin'] : '0';
|
||||||
if (add_user($_POST['emailaddress'], $isadmin, $_POST['password']) === TRUE) {
|
if (add_user($_POST['emailaddress'], $isadmin, $_POST['password']) === TRUE) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue