diff --git a/invenio_accounts/models.py b/invenio_accounts/models.py index db81bf71..fe13b76a 100644 --- a/invenio_accounts/models.py +++ b/invenio_accounts/models.py @@ -100,7 +100,7 @@ class User(db.Model, Timestamp, UserMixin): _displayname = db.Column("displayname", db.String(255), nullable=True) """Case-preserving version of the username.""" - _email = db.Column("email", db.String(255), unique=True) + email = db.Column(db.String(255), unique=True) """User email.""" password = db.Column(db.String(255)) @@ -203,16 +203,6 @@ def username(self, username): self._displayname = username self._username = username.lower() - @hybrid_property - def email(self): - """Get email.""" - return self._email - - @email.setter - def email(self, email): - """Set lowercase email.""" - self._email = email.lower() - @hybrid_property def user_profile(self): """Get the user profile.""" @@ -239,7 +229,7 @@ def preferences(self): if self._preferences is None: return None elif not isinstance(self._preferences, UserPreferenceDict): - self._preferences = UserPreferenceDict(**self._preferences) + return UserPreferenceDict(**self._preferences) return self._preferences