mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-23 07:18:07 +00:00
expand email validation regex to catch more valid emails see comments on PR #3254
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
2de5362adc
commit
a9b19df4ec
@ -519,7 +519,9 @@ Options:
|
|||||||
if [[ -n "${args[2]}" ]]; then
|
if [[ -n "${args[2]}" ]]; then
|
||||||
|
|
||||||
# Sanitize email address in case of security issues
|
# 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
|
local regex
|
||||||
|
regex="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$"
|
||||||
|
if [[ ! "${args[2]}" =~ ${regex} ]]; then
|
||||||
echo -e " ${CROSS} Invalid email address"
|
echo -e " ${CROSS} Invalid email address"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user