From 36df32236cc8c2e63d92e3c22f2d964b66f88503 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Thu, 31 Aug 2023 23:59:53 +0200 Subject: [PATCH] Update main.lib.php - Username can only contain letters, numbers and 1 underscore. --- setup/lib/main.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup/lib/main.lib.php b/setup/lib/main.lib.php index 712c38f..9ed4639 100644 --- a/setup/lib/main.lib.php +++ b/setup/lib/main.lib.php @@ -110,6 +110,10 @@ function validate() { if (($fppwd) != ($fppwd2)) { $err [] = "Passwords did not match"; } + if (!(preg_match('/^[a-zA-Z0-9]+_?[a-zA-Z0-9]+$/D', $fpuser) || preg_match('/^[a-zA-Z0-9]+_?[a-zA-Z0-9]+$/D', $fpuser))) { + $err [] = $fpuser . " is not a valid username. + Username can only contain letters, numbers and 1 underscore."; + } if (!(preg_match('!@.*@|\.\.|\,|\;!', $email) || preg_match('!^.+\@(\[?)[a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$!', $email))) { $err [] = $email . " is not a valid email address"; }