Ver código fonte

1 letter username. fixes #96

Serghey Rodin 12 anos atrás
pai
commit
d4b5bddeef
1 arquivos alterados com 11 adições e 4 exclusões
  1. 11 4
      func/main.sh

+ 11 - 4
func/main.sh

@@ -616,10 +616,17 @@ validate_format_name_s() {
 
 
 # Username
 # Username
 validate_format_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
     fi
 }
 }