def reg_user_by_form(): ''' @todo:注册用户 ''' res = reg_user(form2dic(request.form)) if res: session.update(set_user_session({}, res)) return redirect('/') else: return render_template('info.html', info=u"服务器错误")
def update_user_action(): _id = session.get('_id', None) if _id: user = form2dic(request.form) user.pop('password') user = update_user(_id, user) session.clear() session.update(set_user_session({}, user)) return redirect('/') else: return redirect('/')
def login(): ''' @todo:登录 ''' user = vertify_user( request.form.get('_id', ''), request.form.get('password', '') ) if user: session.update(set_user_session({}, user)) session.permanent = True return redirect(request.headers.get("Referer", "/")) else: session['err_msg'] = u"帐号密码错误" if request.form.get("return", None): return render_template('login.html',login="******", info=u"帐号密码错误") else: return redirect(request.headers.get("Referer", "/"))