Sanitize email address in case of security issues (#3254)

* Sanitize email address in case of security issues

Signed-off-by: bash-c <aboultraman@gmail.com>
This commit is contained in:
M4x 2020-04-05 17:20:35 +08:00 committed by GitHub
parent a2d2639ee8
commit 2de5362adc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -517,6 +517,13 @@ Options:
fi fi
if [[ -n "${args[2]}" ]]; then if [[ -n "${args[2]}" ]]; then
# Sanitize email address in case of security issues
if [[ ! "${args[2]}" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$ ]]; then
echo -e " ${CROSS} Invalid email address"
exit 0
fi
change_setting "ADMIN_EMAIL" "${args[2]}" change_setting "ADMIN_EMAIL" "${args[2]}"
echo -e " ${TICK} Setting admin contact to ${args[2]}" echo -e " ${TICK} Setting admin contact to ${args[2]}"
else else