Merge pull request #340 from YerdosNar/feature/password_check
feat: add password confirmation loop and mask input
This commit is contained in:
29
menu.sh
29
menu.sh
@ -18,7 +18,6 @@ check_services() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# OPTION HANDLERS (ONLY NEEDED ONE)
|
|
||||||
hysteria2_install_handler() {
|
hysteria2_install_handler() {
|
||||||
if systemctl is-active --quiet hysteria-server.service; then
|
if systemctl is-active --quiet hysteria-server.service; then
|
||||||
echo "The hysteria-server.service is currently active."
|
echo "The hysteria-server.service is currently active."
|
||||||
@ -660,7 +659,6 @@ normalsub_handler() {
|
|||||||
echo "Error: SUBPATH must include at least one uppercase letter, one lowercase letter, and one number."
|
echo "Error: SUBPATH must include at least one uppercase letter, one lowercase letter, and one number."
|
||||||
else
|
else
|
||||||
python3 $CLI_PATH normal-sub -a edit_subpath -sp "$subpath"
|
python3 $CLI_PATH normal-sub -a edit_subpath -sp "$subpath"
|
||||||
# echo "SUBPATH updated successfully!"
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -728,12 +726,24 @@ webpanel_handler() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -e -p "Enter the admin password: " admin_password
|
read -sp "Enter the admin password: " admin_password
|
||||||
|
echo ""
|
||||||
if [ -z "$admin_password" ]; then
|
if [ -z "$admin_password" ]; then
|
||||||
echo "Admin password cannot be empty. Please try again."
|
echo "Admin password cannot be empty. Please try again."
|
||||||
else
|
continue
|
||||||
|
fi
|
||||||
|
local check_password
|
||||||
|
read -sp "Enter the admin password again: " check_password
|
||||||
|
echo ""
|
||||||
|
if [ -z "$check_password" ]; then
|
||||||
|
echo "Admin password cannot be empty. Please try again."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [ "$check_password" == "$admin_password" ]; then
|
||||||
|
echo "Password is set!"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
echo "Passwords did NOT match. Please try again."
|
||||||
done
|
done
|
||||||
|
|
||||||
python3 $CLI_PATH webpanel -a start -d "$domain" -p "$port" -au "$admin_username" -ap "$admin_password"
|
python3 $CLI_PATH webpanel -a start -d "$domain" -p "$port" -au "$admin_username" -ap "$admin_password"
|
||||||
@ -972,7 +982,7 @@ ip_limit_handler() {
|
|||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
read -e -p "Enter Block Duration (seconds, default: 60): " block_duration
|
read -e -p "Enter Block Duration (seconds, default: 60): " block_duration
|
||||||
block_duration=${block_duration:-60} # Default to 60 if empty
|
block_duration=${block_duration:-60}
|
||||||
if ! [[ "$block_duration" =~ ^[0-9]+$ ]]; then
|
if ! [[ "$block_duration" =~ ^[0-9]+$ ]]; then
|
||||||
echo "Invalid Block Duration. Please enter a number."
|
echo "Invalid Block Duration. Please enter a number."
|
||||||
else
|
else
|
||||||
@ -982,7 +992,7 @@ ip_limit_handler() {
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -e -p "Enter Max IPs per User (default: 1): " max_ips
|
read -e -p "Enter Max IPs per User (default: 1): " max_ips
|
||||||
max_ips=${max_ips:-1} # Default to 1 if empty
|
max_ips=${max_ips:-1}
|
||||||
if ! [[ "$max_ips" =~ ^[0-9]+$ ]]; then
|
if ! [[ "$max_ips" =~ ^[0-9]+$ ]]; then
|
||||||
echo "Invalid Max IPs. Please enter a number."
|
echo "Invalid Max IPs. Please enter a number."
|
||||||
else
|
else
|
||||||
@ -1047,7 +1057,6 @@ ip_limit_handler() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to display the main menu
|
|
||||||
display_main_menu() {
|
display_main_menu() {
|
||||||
clear
|
clear
|
||||||
tput setaf 7 ; tput setab 4 ; tput bold
|
tput setaf 7 ; tput setab 4 ; tput bold
|
||||||
@ -1080,7 +1089,6 @@ display_main_menu() {
|
|||||||
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to handle main menu options
|
|
||||||
main_menu() {
|
main_menu() {
|
||||||
clear
|
clear
|
||||||
local choice
|
local choice
|
||||||
@ -1100,7 +1108,6 @@ main_menu() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to display the Blitz menu
|
|
||||||
display_hysteria2_menu() {
|
display_hysteria2_menu() {
|
||||||
clear
|
clear
|
||||||
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
||||||
@ -1126,7 +1133,6 @@ display_hysteria2_menu() {
|
|||||||
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to handle Hysteria2 menu options
|
|
||||||
hysteria2_menu() {
|
hysteria2_menu() {
|
||||||
clear
|
clear
|
||||||
local choice
|
local choice
|
||||||
@ -1152,7 +1158,6 @@ hysteria2_menu() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get Advance menu
|
|
||||||
display_advance_menu() {
|
display_advance_menu() {
|
||||||
clear
|
clear
|
||||||
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
echo -e "${LPurple}◇──────────────────────────────────────────────────────────────────────◇${NC}"
|
||||||
@ -1181,7 +1186,6 @@ display_advance_menu() {
|
|||||||
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
echo -ne "${yellow}➜ Enter your option: ${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to handle Advance menu options
|
|
||||||
advance_menu() {
|
advance_menu() {
|
||||||
clear
|
clear
|
||||||
local choice
|
local choice
|
||||||
@ -1214,6 +1218,5 @@ advance_menu() {
|
|||||||
read -rp "Press Enter to continue..."
|
read -rp "Press Enter to continue..."
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
# Main function to run the script
|
|
||||||
define_colors
|
define_colors
|
||||||
main_menu
|
main_menu
|
||||||
Reference in New Issue
Block a user