imprvoved validator

This commit is contained in:
Serghey Rodin 2013-01-20 15:46:13 +02:00
commit a8a86aced9

View file

@ -556,12 +556,7 @@ validate_format_email() {
# Username # Username
validate_format_username() { validate_format_username() {
if ! [[ "$1" =~ ^[[:alnum:]]+([\.|_|-][[:alnum:]]+)?$ ]]; then if ! [[ "$1" =~ ^[[:alnum:]][-|\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]; then
echo "Error: $2 $1 is not valid"
log_event "$E_INVALID" "$EVENT"
exit $E_INVALID
fi
if [[ "${#1}" -gt 28 ]]; then
echo "Error: $2 $1 is not valid" echo "Error: $2 $1 is not valid"
log_event "$E_INVALID" "$EVENT" log_event "$E_INVALID" "$EVENT"
exit $E_INVALID exit $E_INVALID