[aur-dev] [PATCH] Accept upper case letters in valid_username()

Lukas Fleischer archlinux at cryptocrack.de
Fri May 30 03:43:50 EDT 2014


In commit 0722f46 (Simplify valid_user() and valid_username(),
2014-02-06), the conversion to lower case letters was unintentionally
removed and in consequence, names with upper case letters have been
rejected since then.

Instead of reintroducing the conversion, add the "i" modifier to the
regular expression validating the name to do case-insensitive pattern
matching.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/lib/acctfuncs.inc.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 962ebb4..51ffec6 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -538,7 +538,7 @@ function valid_username($user) {
 	if (strlen($user) < USERNAME_MIN_LEN ||
 	    strlen($user) > USERNAME_MAX_LEN) {
 		return false;
-	} else if (!preg_match("/^[a-z0-9]+[.\-_]?[a-z0-9]+$/", $user)) {
+	} else if (!preg_match("/^[a-z0-9]+[.\-_]?[a-z0-9]+$/i", $user)) {
 		return false;
 	}
 
-- 
1.9.3



More information about the aur-dev mailing list