Skip to content

Commit a8a86ac

Browse files
committed
imprvoved validator
1 parent 55b905f commit a8a86ac

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

func/main.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,7 @@ validate_format_email() {
556556

557557
# Username
558558
validate_format_username() {
559-
if ! [[ "$1" =~ ^[[:alnum:]]+([\.|_|-][[:alnum:]]+)?$ ]]; then
560-
echo "Error: $2 $1 is not valid"
561-
log_event "$E_INVALID" "$EVENT"
562-
exit $E_INVALID
563-
fi
564-
if [[ "${#1}" -gt 28 ]]; then
559+
if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]; then
565560
echo "Error: $2 $1 is not valid"
566561
log_event "$E_INVALID" "$EVENT"
567562
exit $E_INVALID

0 commit comments

Comments
 (0)