def logout(self, ignore_cookie=False): sh.session.id = 0 sh.session.is_login = False sh.session.name = '' if not ignore_cookie: sh.setCookie('email', None) sh.setCookie('md5password', None)
def login(self, user, remember_me=False, ignore_cookie=False, inc_count=True): sh.session.id = user.id sh.session.is_login = True sh.session.name = user.name if remember_me and not ignore_cookie: sh.setCookie('email', user.email) sh.setCookie('md5password', user.password) if user.has_key('login_count') and inc_count: sh.model(self.model_name).update(user.id, {'login_count': user.login_count+1})