示例#1
0
文件: user.py 项目: yy1117/crontab.py
 def authenticate(self, username, password):
     active = User.select().where(User.active == True)
     try:
         user = active.where(User.username == username).get()
     except User.DoesNotExist:
         return False
     else:
         if not check_password(password, user.password):
             return False
         return user
示例#2
0
文件: user.py 项目: yy1117/crontab.py
    def get_logged_in_user(self):
        if session.get('logged_in'):
            if getattr(g, 'user', None):
                return g.user

            try:
                return User.select().where(
                    User.active == True,
                    User.id == session.get('user_pk')).get()
            except User.DoesNotExist:
                pass