Skip to content

Commit d4b5bdd

Browse files
committed
1 letter username. fixes hestiacp#96
1 parent 11a2735 commit d4b5bdd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

func/main.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,17 @@ validate_format_name_s() {
616616

617617
# Username
618618
validate_format_username() {
619-
if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]]; then
620-
echo "Error: $2 $1 is not valid"
621-
log_event "$E_INVALID" "$EVENT"
622-
exit $E_INVALID
619+
if [ "${#1}" -eq 1 ]; then
620+
if ! [[ "$1" =~ [a-z] ]]; then
621+
echo "Error: $2 $1 is not valid"
622+
exit 1
623+
fi
624+
else
625+
if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]]
626+
then
627+
echo "Error: $2 $1 is not valid"
628+
exit 1
629+
fi
623630
fi
624631
}
625632

0 commit comments

Comments
 (0)