diff --git a/app/auth/models.py b/app/auth/models.py index 27763ed..e276fd9 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -49,6 +49,7 @@ class User(UserMixin, db.Model): name = db.Column(db.String(100)) login = db.Column(db.String(100), unique=True) role = db.Column(db.Integer, default=0) + password = db.Column(db.String(128)) password_hash = db.Column(db.String(128)) def __repr__(self): @@ -57,7 +58,11 @@ class User(UserMixin, db.Model): # Set role at construction time def __init__(self, **kwargs): super(User, self).__init__(**kwargs) - self.set_role(kwargs['role']) + if ('role' in kwargs): + self.set_role(kwargs['role']) + if ('password' in kwargs): + self.set_password(kwargs['password']) + self.password = None def set_role(self, role): self.role = _checkRole(role) -- libgit2 0.21.2