fix(script): allow unlimited values in edit_user script
This commit is contained in:
@ -20,11 +20,11 @@ validate_username() {
|
|||||||
|
|
||||||
validate_traffic_limit() {
|
validate_traffic_limit() {
|
||||||
local traffic_limit=$1
|
local traffic_limit=$1
|
||||||
if [ -z "$traffic_limit" ]; then
|
if [ -z "$traffic_limit" ]; then
|
||||||
return 0 # Optional value is valid
|
return 0 # Optional value is valid
|
||||||
fi
|
fi
|
||||||
if ! [[ "$traffic_limit" =~ ^[0-9]+$ ]]; then
|
if ! [[ "$traffic_limit" =~ ^[0-9]+$ ]]; then
|
||||||
echo "Traffic limit must be a valid integer."
|
echo "Error: Traffic limit must be a valid non-negative number (use 0 for unlimited)."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@ -32,11 +32,11 @@ validate_traffic_limit() {
|
|||||||
|
|
||||||
validate_expiration_days() {
|
validate_expiration_days() {
|
||||||
local expiration_days=$1
|
local expiration_days=$1
|
||||||
if [ -z "$expiration_days" ]; then
|
if [ -z "$expiration_days" ]; then
|
||||||
return 0 # Optional value is valid
|
return 0 # Optional value is valid
|
||||||
fi
|
fi
|
||||||
if ! [[ "$expiration_days" =~ ^[0-9]+$ ]]; then
|
if ! [[ "$expiration_days" =~ ^[0-9]+$ ]]; then
|
||||||
echo "Expiration days must be a valid integer."
|
echo "Error: Expiration days must be a valid non-negative number (use 0 for unlimited)."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@ -237,4 +237,4 @@ edit_user() {
|
|||||||
|
|
||||||
|
|
||||||
# Run the script
|
# Run the script
|
||||||
edit_user "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
edit_user "$1" "$2" "$3" "$4" "$5" "$6" "$7"
|
||||||
Reference in New Issue
Block a user