pgadmin4/web/pgadmin/utils/validation_utils.py
Aditya Toshniwal b82e6dbdb8 1) Added email id validation on the login page.
2) Added validation for the file manager.
2020-09-11 19:55:19 +05:30

27 lines
683 B
Python

##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import re
def validate_email(email):
if email == '' or email is None:
return False
email_filter = re.compile(
"^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9]"
"(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]"
"(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
)
if not email_filter.match(email):
return False
return True