Check Usernames
This commit is contained in:
4
menu.sh
4
menu.sh
@ -28,7 +28,11 @@ hysteria2_add_user_handler() {
|
|||||||
read -p "Enter the username: " username
|
read -p "Enter the username: " username
|
||||||
|
|
||||||
if [[ "$username" =~ ^[a-zA-Z0-9]+$ ]]; then
|
if [[ "$username" =~ ^[a-zA-Z0-9]+$ ]]; then
|
||||||
|
if python3 $CLI_PATH get-user --username "$username" > /dev/null 2>&1; then
|
||||||
|
echo -e "${red}Error:${NC} Username already exists. Please choose another username."
|
||||||
|
else
|
||||||
break
|
break
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${red}Error:${NC} Username can only contain letters and numbers."
|
echo -e "${red}Error:${NC} Username can only contain letters and numbers."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user