Check Usernames

This commit is contained in:
Whispering Wind
2024-08-05 18:49:45 +03:30
committed by GitHub
parent 1ba4250756
commit 8f35e418d7

View File

@ -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
break 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
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