From 654838bfc81ead6e72e9b7de1816405628b18831 Mon Sep 17 00:00:00 2001 From: dpeca Date: Wed, 26 Oct 2016 02:53:03 +0200 Subject: [PATCH] More informative error for long MySQL username We talked about it at https://github.com/serghey-rodin/vesta/issues/860 issue --- func/main.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/func/main.sh b/func/main.sh index b6eb57e48..e0ea2c3d6 100644 --- a/func/main.sh +++ b/func/main.sh @@ -583,7 +583,10 @@ is_date_format_valid() { # Database user validator is_dbuser_format_valid() { exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]" - if [[ "$1" =~ $exclude ]] || [ 17 -le ${#1} ]; then + if [ 17 -le ${#1} ]; then + check_result $E_INVALID "mysql username can be up to 16 characters long" + fi + if [[ "$1" =~ $exclude ]]; then check_result $E_INVALID "invalid $2 format :: $1" fi }