From d4b5bddeefbfb0b62535264fc33fe6452cb38b5b Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 6 Feb 2014 12:43:47 +0200 Subject: [PATCH] 1 letter username. fixes #96 --- func/main.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/func/main.sh b/func/main.sh index a761bc8f..eadfbb82 100644 --- a/func/main.sh +++ b/func/main.sh @@ -616,10 +616,17 @@ validate_format_name_s() { # Username validate_format_username() { - if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]]; then - echo "Error: $2 $1 is not valid" - log_event "$E_INVALID" "$EVENT" - exit $E_INVALID + if [ "${#1}" -eq 1 ]; then + if ! [[ "$1" =~ [a-z] ]]; then + echo "Error: $2 $1 is not valid" + exit 1 + fi + else + if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]] + then + echo "Error: $2 $1 is not valid" + exit 1 + fi fi }