Exemple #1
0
class Users(Authenticatable):
    name = CharField()
    email = CharField(unique=True)
    password = PasswordField()

    class Meta:
        database = db
        auth_column = 'name'
Exemple #2
0
    class User(Model):
        email = peewee.CharField(max_length=100, null=False, unique=True)
        password = PasswordField(null=False, iterations=4)
        active = peewee.BooleanField(null=False, default=True)

        @classmethod
        def base_query(cls):
            # Only query for active Users
            return super(User, cls).base_query().where(cls.active == True)
Exemple #3
0
class User(BaseModel):
    _id = UUIDField(primary_key=True)
    username = CharField(max_length=80, unique=True)
    password = PasswordField()
    main_email = CharField(max_length=80, unique=True)
    ctime = DateTimeField(formats='%Y-%m-%d %H:%M:%S')
    roles = ManyToManyField(Role, related_name='users')

    def __unicode__(self):
        return self.username
Exemple #4
0
class Users(Authenticatable):
    ''' The User Model. Used for authentication purposes '''
    name = CharField()
    email = CharField(unique=True)
    password = PasswordField()

    class Meta:
        ''' Additional settings for this Model '''
        database = db
        auth_column = 'name'
Exemple #5
0
class admin(baseModel):
    username = CharField(unique=True)
    nickname = CharField(max_length=20,help_text=u'将会对外显示',null=True)
    password = PasswordField(help_text=u'采用bcrypt加密')

    # time
    register_time = DateTimeField(default=datetime.datetime.now,help_text=u'注册时间')

    # permissions
    isStaff = BooleanField(default=False,help_text=u'是否能登陆至仪表盘')
    isAdmin = BooleanField(default=False,help_text=u'是否能具有管理员权限')

    def authPassword(self,password):
        return bcrypt.checkpw(password.encode('utf-8'), self.password.encode('utf-8')) and len(password) > 8
Exemple #6
0
class admin(baseModel):
    username = CharField(unique=True)
    nickname = CharField(max_length=20, null=True)
    password = PasswordField()

    # time
    register_time = DateTimeField(
        default=datetime.datetime.now,
        help_text=u'注册时间')

    # permissions
    isStaff = BooleanField(default=False)
    isAdmin = BooleanField(default=False)

    def authPassword(self, password):
        return self.password.check_password(password)
Exemple #7
0
class User(BaseModel):
    username = pw.CharField(max_length=70, unique=True)
    password = PasswordField()
    state = pw.BooleanField(default=True)

    def is_authenticated(self):
        return True

    def is_active(self):
        return self.state

    def is_anonymous(self):
        return False

    def get_id(self):
        return str(self.id)

    def __repr__(self):
        return '<User %r>' % (self.username)
Exemple #8
0
class User(BaseModel):
    username = CharField(unique=True)
    email = CharField(unique=True)
    phone = CharField(null=True)
    password = PasswordField()

    def __repr__(self):
        return (
            f"User("
            f"id={self.id!r}, "
            f"username={self.username!r}, "
            f"email={self.email!r}, "
            f"phone={self.phone!r}, "
            f"password={self.password!r}, "
            f"created_at={self.created_at:%Y-%m-%d %H:%M:%S}, "
            f"updated_at={self.updated_at:%Y-%m-%d %H:%M:%S})"
        )

    class Meta:
        order_by = ('created_at',)
Exemple #9
0
class User(BaseModel):
    name = CharField()
    email = CharField(unique=True)
    password = PasswordField()
Exemple #10
0
 class PasswordModel(TestModel):
     username = TextField()
     password = PasswordField(iterations=4)