def post(self): n = self.get_argument('nick', None) if n is None:return self.render('login.html', **{'warning': '请先报上名号', 'n':n}) p = self.get_argument('password', None) if p is None:return self.render('login.html', **{'warning': '您接头暗号是?', 'n':n}) nt = self.get_argument('next', None) u = User() r = u.login(n, p) if r[0]: # self.set_secure_cookie("user", n, 1) self.SESSION['uid']=u._id self.SESSION['nick']=n self.redirect(nt) if nt else self.redirect('/account/profile') else: return self.render('profile/login.html', **{'warning': r[1], 'n':n})
def post(self): n = self.get_argument('nick', None) if n is None:return self.write({'error':'请先报上名号'}) p = self.get_argument('password', None) if p is None:return self.write({'error':'您接头暗号是'}) nt = self.get_argument('next', None) u = User() r = u.login(n, p) if r[0]: # self.set_secure_cookie("user", n, 1) self.SESSION['uid']=u._id self.SESSION['nick']=n self.write({'uid':u._id}) else: self.write({'error':r[1]})