Skip to content

Commit

Permalink
Fix register api email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Liu233w committed Feb 13, 2022
1 parent eff2d70 commit ec23348
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/UserAuthAPI/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def validate_telNumber(self, value):
return value

def validate_email(self, value):
regex = r'^[a-zA-Z0-9]+[\._]?[a-zA-Z0-9]+[@]\w+[.]\w{2,3}$'
# regex extracted from https://emailregex.com/
regex = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
if(not re.search(regex, value)):
raise serializers.ValidationError(_('Invalid email Address'))

Expand Down

0 comments on commit ec23348

Please sign in to comment.