mirror of
https://github.com/slawkens/myaac.git
synced 2026-04-12 21:43:31 +02:00
Better name validation, like in the original game website (#356)
* Better name validation, like in the original game website
* Don't automatically ucfirst and strtolower the cases of the word
* This allows for names like: Lord of Ring, Man of the Earth etc.
* Don't allow special characters like: -, [], '
* Don't allow one letter words
* Require at least one vowel per word
* Add notice about admin logged in
* Add trim, for future
Currently its stripped anyway in the init.php, but AI don't know it :P
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Implement AI recommended changes
* Update tools/validate.php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Trim $name
* Update Validator.php
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -63,10 +63,7 @@ else if(isset($_GET['email']))
|
||||
}
|
||||
else if(isset($_GET['name']))
|
||||
{
|
||||
$name = $_GET['name'];
|
||||
if(!admin()) {
|
||||
$name = strtolower(stripslashes($name));
|
||||
}
|
||||
$name = trim(stripslashes($_GET['name']));
|
||||
|
||||
if(!Validator::characterName($name)) {
|
||||
error_(Validator::getLastError());
|
||||
@@ -81,7 +78,12 @@ else if(isset($_GET['name']))
|
||||
error_($errors['name']);
|
||||
}
|
||||
|
||||
success_('Good. Your name will be:<br /><b>' . (admin() ? $name : ucwords($name)) . '</b>');
|
||||
$extraText = '';
|
||||
if (admin()) {
|
||||
$extraText = "<br/>Note: You are logged in as admin, so you can create almost any name without rules.";
|
||||
}
|
||||
|
||||
success_("Good. Your name will be:<br /><b>$name</b>$extraText");
|
||||
}
|
||||
else if(isset($_GET['password']) && isset($_GET['password_confirm'])) {
|
||||
$password = $_GET['password'];
|
||||
|
||||
Reference in New Issue
Block a user