Skip to content

Commit 902ed11

Browse files
committed
fixed underscore bug in user validation function
1 parent df56918 commit 902ed11

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

func/main.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,12 @@ validate_format_email() {
556556

557557
# Username
558558
validate_format_username() {
559-
if ! [[ "$1" =~ ^[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)?$ ]] || [[ "${#1}" -gt 28 ]]
560-
then
559+
if ! [[ "$1" =~ ^[a-zA-Z0-9]+([\.|_][a-zA-Z0-9]+)?$ ]]; 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
561565
echo "Error: $2 $1 is not valid"
562566
log_event "$E_INVALID" "$EVENT"
563567
exit $E_INVALID

0 commit comments

Comments
 (0)