コード例 #1
0
def withdrawal():
    data = OrderedDict()
    data['status'] = 'error'
    if request.method == 'POST':
        if session:
            password = request.form['PASSWORD']

            db = DB()
            user_buf = db.login(session['id'], password)
            if user_buf == None:
                data['status'] = 'password_discordance'
                return jsonify(data)

            buf = user(\
                   id=user_buf.id, \
                   permission= session['permission'],\
                   password='',\
                   email='',\
                   name='',\
                   cell_phone='',\
                   m_delete=1)
            if db.modify(buf):
                if db.user_delete_update_board(buf.id):
                    del db
                    session.clear()
                    data['status'] = 'ok'
                    return jsonify(data)
            del db
    return jsonify(data)
コード例 #2
0
def modify():
    if request.method == 'POST':
        id = session['id']
        newpassword = request.form['new_password']
        email = request.form['email']
        name = request.form['name']
        cell_phone = request.form['cell_phone']

        buf = user(\
                   id=id, \
                   permission= session['permission'],\
                   password=newpassword,\
                   email=email,\
                   name=name,\
                   cell_phone=cell_phone)

        data = OrderedDict()

        db = DB()
        if newpassword == '':
            if db.modify_nopassword(buf):
                session_refresh(buf.id)
                data['status'] = 'ok'
            else:
                data['status'] = 'fail'
        else:
            if db.modify(buf):
                session_refresh(buf.id)
                data['status'] = 'ok'
            else:
                data['status'] = 'fail'
        del db
        return jsonify(data)
    data['status'] = 'error'
    return jsonify(data)