#!/usr/bin/env python # -*- coding: utf-8 -*- """ demeter web page name:user.py author:rabin """ from __load__ import * class login_path(Load): @Web.setting def post(self): mobile = self.input('username') password = self.input('password') if mobile and password: user = self.service('common').one('farm_user', mobile=mobile) if user: temp = user['password'].split('_') if Demeter.md5(password, temp[1]) == user['password']: self.set_secure_cookie('user', str(user['id'])) self.out('yes', {'id':user['id']}) return self.out('手机号或安全码错误,登录失败') class loginout_path(Load): @Web.setting def get(self): self.set_secure_cookie('user', '') self.redirect('/user/login')