Don't try to set password if it isn't passed in

master
Steven Loria 11 years ago
parent 4aea7377a1
commit 3344480ffb
  1. 3
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/models.py

@ -19,7 +19,8 @@ class User(db.Model):
def __init__(self, username=None, email=None, password=None): def __init__(self, username=None, email=None, password=None):
self.username = username self.username = username
self.email = email self.email = email
self.set_password(password) if password:
self.set_password(password)
def set_password(self, password): def set_password(self, password):
self.password = pwd_context.encrypt(password) self.password = pwd_context.encrypt(password)

Loading…
Cancel
Save