Example #1
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         return render_settings(password_form=f)
     else:
         users.update(session.get_user_id(), password=f.d.password)
         session.reset()
         return render_settings(on_success_message='Your password has been successfuly changed.')
Example #2
0
 def POST(self):
     per = users.get_permission_by_douid(user.douban_id)
     rights = per[0].rights
     if rights > 1:
         data = web.input()
         uid = data.uid
         #note : 只是设为了close 1 没有删除,未做完
         users.update(uid, close = 1)
Example #3
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         return render_settings(email_form=f)
     else:
         users.update(session.get_user_id(), email=f.d.email)
         session.reset()
         raise web.seeother('/settings')
Example #4
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         return render_settings(email_form=f)
     else:
         users.update(session.get_user_id(), email=f.d.email)
         session.reset()
         raise web.seeother('/settings')
Example #5
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         return render_settings(password_form=f)
     else:
         users.update(session.get_user_id(), password=f.d.password)
         session.reset()
         return render_settings(
             on_success_message='Your password has been successfuly changed.'
         )
Example #6
0
 def POST(self):
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.register_detail_form(), '/cumt/Profile')
     if not f.form.validates(ipt):
         s = mww.ListGroup(session.get_session().actions).render()
         l = mww.Panel('Settings', s)
         r = mww.Panel('Profile', f.render_css())
         return render.l3r9(left=l.render(), right=r.render())
     else:
         users.update(
             session.get_session().uid,
             **utils.extract_info_from_storage_by_list(ipt, PROPERTY_LIST))
         session.login(session.get_session().email)
         return render.single_panel(title="Profile Change", body="success!")
Example #7
0
 def POST(self, token):
     f = self.form()
     show = web.input().show
     if not f.validates(web.input(_unicode=False)):
         return render_account(show='reset_password_only', reset_password_form=f, token = token)
     elif f.d.password != f.d.again:
         return render_account(
             show = 'reset_password_only',
             token = token,
             error_message = '<span class="alert alert-error">两次输入的密码不一致</span>'
         )
     else:
         id = users.get_user_by_email(users.get_email(token)).get('id',False)
         users.update(id, password=hashlib.md5(f.d.password + encryption_key).hexdigest()) #更新密码 todo:是不是应该写到model里的
         users.update_valid(token) #更改 valid 为 1 表示已经更改了密码
         return render_account(
             show = 'reset_password_success',
             on_success_message = '密码已更新'
         ) 
Example #8
0
 def POST(self, token):
     f = self.form()
     show = web.input().show
     if not f.validates(web.input(_unicode=False)):
         return render_account(show='reset_password_only',
                               reset_password_form=f,
                               token=token)
     elif f.d.password != f.d.again:
         return render_account(
             show='reset_password_only',
             token=token,
             error_message=
             '<span class="alert alert-error">两次输入的密码不一致</span>')
     else:
         id = users.get_user_by_email(users.get_email(token)).get(
             'id', False)
         users.update(id,
                      password=hashlib.md5(f.d.password + encryption_key).
                      hexdigest())  #更新密码 todo:是不是应该写到model里的
         users.update_valid(token)  #更改 valid 为 1 表示已经更改了密码
         return render_account(show='reset_password_success',
                               on_success_message='密码已更新')