File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ name=$5
2121if [ -n " $6 " ]; then
2222 name=" $name $6 "
2323fi
24+
25+ FROM_V_ADD_USER=true
26+
2427# Includes
2528# shellcheck source=/etc/hestiacp/hestia.conf
2629source /etc/hestiacp/hestia.conf
Original file line number Diff line number Diff line change @@ -748,8 +748,12 @@ is_user_format_valid() {
748748 if [ " $1 " != " ${1// [^[:ascii:]]/ } " ]; then
749749 check_result " $E_INVALID " " invalid $2 format :: $1 "
750750 fi
751- if ! [[ " $1 " =~ ^[a-zA-Z]+ ]]; then
752- check_result " $E_INVALID " " invalid $2 format :: $1 "
751+
752+ # Only for new users
753+ if [[ " $FROM_V_ADD_USER " == " true" ]]; then
754+ if ! [[ " $1 " =~ ^[a-zA-Z][-| .| _[:alnum:]]{0,28}[[:alnum:]]$ ]]; then
755+ check_result " $E_INVALID " " invalid $2 format :: $1 "
756+ fi
753757 fi
754758}
755759
Original file line number Diff line number Diff line change @@ -390,6 +390,12 @@ function check_ip_not_banned(){
390390 assert_output --partial ' Error: invalid user format'
391391}
392392
393+ @test " User: Add new user Failed 5" {
394+ run v-add-user ' 1aap' $user $user @hestiacp2.com default " Super Test"
395+ assert_failure $E_INVALID
396+ assert_output --partial ' Error: invalid user format'
397+ }
398+
393399@test " User: Add new user Success 1" {
394400 run v-add-user ' jaap01' $user $user @hestiacp2.com default " Super Test"
395401 assert_success
You can’t perform that action at this time.
0 commit comments