def RevalidEmail(email): try: if email != None: mongo_validator = EmailField() mongo_validator.validate(email) return True except: return False
class Email(Document): from_addr = EmailField() to_addr = EmailField() body = StringField(required=True) user_ref = ReferenceField(DomainUser, required=True) meta = {'collection': 'emails'}
class User(Document): email = EmailField(unique=True, required=True) first_name = StringField(max_length=50) last_name = StringField(max_length=50) emails = ListField(EmailField()) datetime = DateTimeField() datetime_local = DateTimeField() balance = IntField() # in cents
class UserModel(Document): meta = {'collection': 'user_info'} email = EmailField(required=True, unique=True) pwd = StringField(required=True) name = StringField(required=True) age = IntField() cell_phone = StringField()
class User(Document): # http://docs.mongoengine.org/guide/defining-documents.html#fields username = StringField(unique=True, required=True) email = EmailField(unique=True) password = BinaryField(required=True) age = IntField() bio = StringField(max_length=100) # Will accepet strings # categoreis = ListField(StringField()) categories = ListField() admin = BooleanField(default=False) registered = BooleanField(default=False) date_created = DateTimeField(default=datetime.utcnow) @classmethod def json(self): user_dict = { "username": self.username, "email": self.email, "age": self.age, "bio": self.bio, "categories": self.categories, "admin": self.admin, "registered": self.registered } return json.dumps(user_dict) # Create meta information about our document # Check out docs for more meta = { "indexes": ["username", "email"], # ordering in descending fashion "ordering": ["-date_created"] }
class Player(Document): email = EmailField(required=True, unique=True) first_name = StringField(max_length=20) last_name = StringField(max_length=20) nick_name = StringField(max_length=20) handicap = FloatField() gender = StringField(required=True, choices=('man', 'woman'))
class AdminUserModel(Document): user_name = StringField(required=True, max_length=100) email = EmailField(required=True, unique=True) passwd = StringField(required=True, max_length=64, min_length=6) update_time = DateTimeField(default=datetime.now) create_time = DateTimeField(default=datetime.now) role = ListField(StringField(max_length=50, queryset=UserRoleModel)) permissions = ListField( StringField(max_length=50, queryset=PermissionModel)) active = BooleanField() meta = { 'collection': 'admin_user', 'ordering': ['-create_time'], } def clean(self): if not self.id: self.id = ObjectId() self.update_time = datetime.now() if not self.create_time: self.create_time = datetime.now()
class Guy(DynamicDocument): meta = {'collection': 'guys'} ref_id = StringField() ref_name = StringField() name = StringField() email = EmailField() pages_today = IntField(default=0) pages_total = IntField(default=0) shares_today = IntField(default=0) updated = DateTimeField(default=datetime.now()) earnings = FloatField() level = IntField() ref = ReferenceField('Guy') refs = ListField(ReferenceField('Guy')) def next_ref_name(self, n): return '{}_{}'.format(self.ref_name, n) def next_email(self, n): name, domain = self.email.split('@') return '@'.join(['{}+{}'.format(name, n), domain]) def __repr__(self): return 'Guy({})'.format(str(self.to_json()))
class SuperAdmin(db.Document): email = EmailField(required=True, primary_key=True) password = StringField(required=True) approved = BooleanField(default=False) def format(self): return {"email": self.email, "approved": self.approved}
class User(Custom_Document): nickname = StringField(required=True, unique=True, max_length=20) email = EmailField(required=True, unique=True, max_length=50) password_hash = StringField(max_length=200, required=True) about_me = StringField(max_length=200) skills = ListField(EmbeddedDocumentField(Skill)) last_seen = DateTimeField(required=True) @property def password(self): raise AttributeError('password is not a readable') @password.setter @tornado.gen.coroutine def password(self, password): self.password_hash = yield self._executor.submit( bcrypt.hashpw, password, bcrypt.gensalt()) @tornado.gen.coroutine def verify_password(self, password): password_hash = yield self._executor.submit( bcrypt.hashpw, password, self.password_hash) return password_hash == self.password_hash def avatar(self, size): return avatar(self.email, size) def __repr__(self): return '<User %r>' % (self.nickname)
class ContactInfo(EmbeddedDocument): address = StringField() code_postal = StringField() email = EmailField() phone_numbers = ListField(field=StringField(), required=False, default=[]) country = ReferenceField(Country) city = ReferenceField(City) province = ReferenceField(Province)
class User(Document, UserMixin): name = StringField(required=True, max_length=30, unique=True) email = EmailField(required=True, max_length=30, unique=True) password = StringField(required=True, max_length=100) user_type = StringField(required=True, max_length=10) def __repr__(self): return f'User({self.name}, {self.email}, {self.user_type}'
class User(Document): meta = {'collection': 'user'} first_name = StringField() last_name = StringField() age = IntField() mass = FloatField() email = EmailField() runs = ListField(EmbeddedDocumentField(Run))
class Organization(BDocument): name = StringField() contact_full_name = StringField() default_refund_amount = FloatField(default=0) conventions = EmbeddedDocumentListField(OrganizationConvention) address = StringField() email = EmailField() phone_numbers = ListField(field=StringField(), required=False, default=[])
class Users(Document): role = EnumField(Role, default=Role.USER) first_name = StringField(min_length=1, max_length=200) last_name = StringField(min_length=1, max_length=200) email = EmailField(allow_utf8_user=True, unique=True) phone_number = StringField(regex=r"\d{3,}") password = DynamicField(max_length=100) created = DateTimeField(default=datetime.utcnow)
class BusinessAccount(Document): meta = {"collection": "business"} company_name = StringField(unique=True, required=True) email = EmailField() fee = DecimalField() bank_account = StringField() password = StringField(required=True)
class User(Document): firstName = StringField(required=True) lastName = StringField(required=True) username = StringField(required=True, unique=True) email = EmailField(unique=True) password = StringField(required=True) score = IntField(default=0) completed_challenges = ListField(ReferenceField('CTFChallenge'), reverse_delete_rule=PULL) role = StringField(default='Member')
class User(db.DynamicDocument): """ User Model for storing user related details """ id = SequenceField(required=True, primary_key=True) user_name = StringField(min_length=4) password = StringField(required=True) email = EmailField(required=True, unique=True) phone = StringField(min_length=10, required=True, unique=True) registered_on = DateTimeField(default=datetime.datetime.now) def clean(self): self.password = bcrypt.generate_password_hash( self.password, app.config.get('BCRYPT_LOG_ROUNDS')).decode() meta = {"indexes": ["email", "phone"], "ordering": ["-registered_on"]} @staticmethod def encode_auth_token(user_id): """ Generates the Auth Token :return: string """ user_id = str(user_id) try: payload = { 'exp': datetime.datetime.utcnow() + datetime.timedelta(days=5, seconds=5), 'iat': datetime.datetime.utcnow(), 'sub': user_id } return jwt.encode(payload, app.config.get('SECRET_KEY'), algorithm='HS256') except Exception as e: return e @staticmethod def decode_auth_token(auth_token): """ Validates the auth token :param auth_token: :return: integer|string """ try: payload = jwt.decode(auth_token, app.config.get('SECRET_KEY')) is_blacklisted_token = BlacklistToken.check_blacklist(auth_token) if is_blacklisted_token: return 'Token blacklisted. Please log in again.' else: return payload, User.objects.get(id=payload['sub']) except jwt.ExpiredSignatureError: return 'Signature expired. Please log in again.' except jwt.InvalidTokenError: return 'Invalid token. Please log in again.'
class User(Base): email = EmailField() nick_name = StringField(required=True) last_name = StringField(required=False) full_name = StringField(required=True) avatar = StringField(required=False) updated_at = DateTimeField(default=datetime.now, blank=True) meta = { 'collection': 'user' }
class User(Document): meta = {'collection': 'user'} uuid = StringField(required=True, primary_key=True, default=uuid.uuid4()) firstName = StringField(required=True, max_length=200) middleName = StringField() lastName = StringField() email = EmailField(required=True, unique=True) createdOn = DateTimeField(default=datetime.now) lastActiveOn = DateTimeField(default=datetime.now) roles = ListField(ReferenceField(Role))
class UserAccount(Document): meta = {"collection": "user"} username = StringField(unique=True, required=True) email = EmailField() firstname = StringField() lastname = StringField() preference = StringField() isAdmin = BooleanField(default=False) password = StringField(required=True)
class User(Document, UserMixin): active = BooleanField(default=False) admin = BooleanField() email = EmailField(unique=True) first_name = StringField(max_length=255) last_name = StringField(max_length=255) password = StringField(max_length=255) roles = ListField(ReferenceField(Role), default=[]) def __repr__(self): return '<User %r>' % self.email
class Reporter(Document): meta = {'collection': 'test_repoter'} id = StringField(primary_key=True) first_name = StringField(required=True) last_name = StringField(required=True) email = EmailField() articles = ListField(ReferenceField(Article)) embedded_articles = ListField(EmbeddedDocumentField(EmbeddedArticle)) embedded_list_articles = EmbeddedDocumentListField(EmbeddedArticle) awards = ListField(StringField())
class User(mongo.Document): meta = {'collection': 'users'} guid = StringField(unique=True, required=True) username = EmailField(unique=True, required=True) password = StringField(required=True) createdIn = DateTimeField(default=datetime.now) active = BooleanField(default=False) roles = EmbeddedDocumentField(Roles, default=Roles) profile = EmbeddedDocumentField(Profile, default=Profile)
class Job(Document): meta = {"collection": "jobs"} ID = ObjectIdField() description = StringField() minimumRank = IntField() responsibilities = StringField() qualifications = StringField() applyLink = URLField() applyEmail = EmailField() payRange = StringField() qualified = ListField(ReferenceField(User))
class User(Document): meta = {"collection": "users"} ID = ObjectIdField() manager = BooleanField() email = EmailField() level = IntField() rank = ReferenceField(Rank) subscription = ReferenceField(Subscription) admin = BooleanField() recruiter = BooleanField() loggedIn = BooleanField()
class Users(Document): meta = {'collection': 'users'} user_id = SequenceField() public_id = StringField(required=True) name = StringField(required=True) email = EmailField(required=True) password = StringField(required=True) address = StringField() profile_pic = StringField() create_date = StringField( default=datetime.now().strftime("%-d/%B/%Y %I:%M:%S"))
class UserDoc(Document): name = StringField(required=True, min_length=3) email = EmailField(required=True, unique=True) type = StringField(required=True) password = StringField(required=True, min_length=8) meta = { 'collection': 'users', 'indexes': [ '$email' ] }
class Guy(DynamicDocument): meta = {'collection': 'guys'} email = EmailField() balance = FloatField() claimed = DateTimeField() problems = IntField(default=0) def __repr__(self): return 'Guy({})'.format(str(self.to_json()))
class Reporter(Document): meta = {'collection': 'test_repoter'} first_name = StringField(required=True) last_name = StringField(requred=True) email = EmailField() articles = ListField(ReferenceField(Article)) # FIXME # embedded_articles = ListField(EmbeddedDocumentField(EmbeddedArticle)) # FIXME # custom_map = MapField(field=StringField()) awards = ListField(StringField())