mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-11 05:36:34 +01:00
Added case insensitive usernames.
This commit is contained in:
parent
dfed2269c9
commit
e7471eb183
@ -347,7 +347,7 @@ class User {
|
|||||||
|
|
||||||
public static function CleanUsername( $username ) {
|
public static function CleanUsername( $username ) {
|
||||||
|
|
||||||
return preg_replace( '#[^A-Za-z0-9' . preg_quote( '-_@. ').']#', '', $username );
|
return strtolower( preg_replace( '#[^A-Za-z0-9' . preg_quote( '-_@. ').']#', '', $username ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
@ -32,7 +32,7 @@ if ($_GET['action']=='authenticate') {
|
|||||||
die(formatJSEND("error", "Missing username or password"));
|
die(formatJSEND("error", "Missing username or password"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$User->username = $_POST['username'];
|
$User->username = User::CleanUsername( $_POST['username'] );
|
||||||
$User->password = $_POST['password'];
|
$User->password = $_POST['password'];
|
||||||
|
|
||||||
// check if the asked languages exist and is registered in languages/code.php
|
// check if the asked languages exist and is registered in languages/code.php
|
||||||
@ -68,7 +68,7 @@ if ($_GET['action']=='create') {
|
|||||||
die(formatJSEND("error", "Missing username or password"));
|
die(formatJSEND("error", "Missing username or password"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$User->username = User::CleanUsername($_POST['username']);
|
$User->username = User::CleanUsername( $_POST['username'] );
|
||||||
$User->password = $_POST['password'];
|
$User->password = $_POST['password'];
|
||||||
$User->Create();
|
$User->Create();
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ if ($_GET['action']=='delete') {
|
|||||||
die(formatJSEND("error", "Missing username"));
|
die(formatJSEND("error", "Missing username"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$User->username = $_GET['username'];
|
$User->username = User::CleanUsername( $_GET['username'] );
|
||||||
$User->Delete();
|
$User->Delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ if ($_GET['action']=='password') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (checkAccess() || $_POST['username'] == $_SESSION['user']) {
|
if (checkAccess() || $_POST['username'] == $_SESSION['user']) {
|
||||||
$User->username = $_POST['username'];
|
$User->username = User::CleanUsername( $_POST['username'] );
|
||||||
$User->password = $_POST['password'];
|
$User->password = $_POST['password'];
|
||||||
$User->Password();
|
$User->Password();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user