From bde5b8c87713794f283b733bbbd696dcdb87701d Mon Sep 17 00:00:00 2001 From: Kerwin Date: Tue, 12 Feb 2019 23:43:10 +0800 Subject: [PATCH] fix raise error when email is none --- nativeauthenticator/orm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nativeauthenticator/orm.py b/nativeauthenticator/orm.py index 740e235..842a7df 100644 --- a/nativeauthenticator/orm.py +++ b/nativeauthenticator/orm.py @@ -35,6 +35,8 @@ def change_authorization(cls, db, username): @validates('email') def validate_email(self, key, address): + if not address: + return assert re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", address) return address