Commit faf67b0d authored by Cédric Bonhomme's avatar Cédric Bonhomme

Added models for users (for the future authentication system).

parent ec73e302
......@@ -9,7 +9,29 @@ from flask.ext.login import UserMixin
import bson.objectid
class User(Document, UserMixin):
"""
Defines the model for a user.
"""
firstname = StringField(required=True)
lastname = StringField(required = True)
email = EmailField(required=True, unique=True)
pwdhash = StringField(required=True)
feeds = ListField(EmbeddedDocumentField('Feed'))
created_at = DateTimeField(required=True, default=datetime.now)
def get_id(self):
return self.email
def set_password(self, password):
self.pwdhash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.pwdhash, password)
#required for administrative interface
def __unicode__(self):
return self.email
class EPCISEvent(Document):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment