Merge branch 'main' of https://code.antopie.org/Niver/core
This commit is contained in:
commit
a81016a73a
3 changed files with 6 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define("USERNAME_REGEX", "^[a-z]{4,32}$");
|
define("USERNAME_REGEX", "^[\p{L}\p{N}_-]{1,64}$");
|
||||||
define("PASSWORD_REGEX", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]{8,1024}|.{10,1024}$");
|
define("PASSWORD_REGEX", "^(?=.*[\p{Ll}])(?=.*[\p{Lu}])(?=.*[\p{N}]).{8,1024}|.{10,1024}$");
|
||||||
|
|
||||||
define("PLACEHOLDER_USERNAME", "lain");
|
define("PLACEHOLDER_USERNAME", "lain");
|
||||||
define("PLACEHOLDER_PASSWORD", "••••••••••••••••••••••••");
|
define("PLACEHOLDER_PASSWORD", "••••••••••••••••••••••••");
|
||||||
|
@ -15,12 +15,12 @@ define("OPTIONS_PASSWORD", array(
|
||||||
));
|
));
|
||||||
|
|
||||||
function checkPasswordFormat($password) {
|
function checkPasswordFormat($password) {
|
||||||
if (preg_match("/" . PASSWORD_REGEX . "/", $password) !== 1)
|
if (preg_match("/" . PASSWORD_REGEX . "/u", $password) !== 1)
|
||||||
userError("Password malformed.");
|
userError("Password malformed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUsernameFormat($username) {
|
function checkUsernameFormat($username) {
|
||||||
if (preg_match("/" . USERNAME_REGEX . "/", $username) !== 1)
|
if (preg_match("/" . USERNAME_REGEX . "/u", $username) !== 1)
|
||||||
userError("Username malformed.");
|
userError("Username malformed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ function listFsDirs($username) {
|
||||||
$absoluteDirs = glob(CONF['ht']['ht_path'] . "/" . $username . "/*/", GLOB_ONLYDIR);
|
$absoluteDirs = glob(CONF['ht']['ht_path'] . "/" . $username . "/*/", GLOB_ONLYDIR);
|
||||||
$dirs = [];
|
$dirs = [];
|
||||||
foreach ($absoluteDirs as $absoluteDir)
|
foreach ($absoluteDirs as $absoluteDir)
|
||||||
if (preg_match("/^[a-z0-9-]{1,32}$/", basename($absoluteDir)))
|
if (preg_match("/^[\p{L}\p{N}_-]+$/u", basename($absoluteDir)))
|
||||||
array_push($dirs, basename($absoluteDir));
|
array_push($dirs, basename($absoluteDir));
|
||||||
return $dirs;
|
return $dirs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<summary><label for="username">Identifiant</label></summary>
|
<summary><label for="username">Identifiant</label></summary>
|
||||||
Uniquement composé de lettres minuscules.
|
Uniquement composé de lettres minuscules.
|
||||||
</details>
|
</details>
|
||||||
<input id="username" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" required="" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>"><br>
|
<input id="username" maxlength="32" pattern="<?= USERNAME_REGEX ?>" required="" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>"><br>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><label for="password">Clé de passe</label></summary>
|
<summary><label for="password">Clé de passe</label></summary>
|
||||||
|
|
Loading…
Reference in a new issue