def get(self): uid = self.SESSION['uid'] d = {} u = User() u.whois('_id', uid) if u.nick:d['sina_access_token'] = u.sina_access_token self.render('profile/setting_thirdpart.html', **d)
def post(self): uid = self.SESSION['uid'] she = self.get_argument('she', None) if she: u = User() u.whois('_id', she) nick = u.nick p = Permission() r = p._api.award(she, u'site', 'VERIFIER', nick=nick) return self.redirect("/check/")
def is_authed(self, key, value): u = User() u.whois(key, value) if u.uid is None: return False else: self.SESSION['uid']=u._id self.SESSION['nick']=u.nick self.render('ajax/runjs.html', uid=u._id) return True
def get(self): uid = self.SESSION['uid'] d = {} for n in self.KEYS:d[n] = None u = User() u.whois('_id', uid) if u.nick:d['nick'] = u.nick if u.domain:d['domain'] = u.domain if u.added.get('avanta', None):d['avanta'] = u.added['avanta'] if u.live:d['live'] = u.live if u.email:d['mail'] = u.email if u.added.get('phone', None):d['phone'] = u.added['phone'] self.render('profile/setting.html', **d)
def post(self): uid = self.SESSION['uid'] o= self.get_argument('oldpassword', None) if o is None:return self.write({'error':'请输入旧密码'}) n = self.get_argument('newpassword', None) if n is None:return self.write({'error':'请输入新密码'}) c = self.get_argument('confpassword', None) if c is None:return self.write({'error':'请输入确认密码?'}) u = User() u.whois("_id", uid) if (u.password != unicode(md5(o).hexdigest())):return self.write({'error':'密码不正确?'}) if (n != c):return self.write({'error':'新密码不匹配?'}) u._api.edit(uid, password=unicode(md5(n).hexdigest())) return self.write({'ret':'ok'})
def post(self): uid = self.SESSION['uid'] o= self.get_argument('oldpassword', None) if o is None:return self.render('profile/cpassword.html', **{'warning': '请输入旧密码'}) n = self.get_argument('newpassword', None) if n is None:return self.render('profile/cpassword.html', **{'warning': '请输入新密码'}) c = self.get_argument('confpassword', None) if c is None:return self.render('profile/cpassword.html', **{'warning': '请输入确认密码?'}) u = User() u.whois("_id", uid) if (u.password != o):return self.render('profile/cpassword.html', **{'warning': '密码不正确'}) if (n != c):return self.render('profile/cpassword.html', **{'warning': '新密码不匹配'}) u._api.edit(uid, password=n) return self.redirect('/account/setting/')