Esempio n. 1
0
def create_info_action():
    _id = session.get('_id', None)
    if _id: 
        if request.form:     
            create_info(request.form['collection'], form2dic(request.form), _id)
            return redirect(request.form['return'])
        else:
            return redirect('/')
    else:
        return redirect('/')
Esempio n. 2
0
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"服务器错误")
Esempio n. 3
0
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('/')