Esempio n. 1
0
def update(username):
    usr = current_user._get_current_object()
    data = request.json
    if usr.username != username or username != data['username']:
        return "Silly little rabbit, this profile doesn't belong to you!", 503
    try:
        user.update(usr, **data)
    except Exception:
        # TODO :: Log that shit
        return "An unknown error occoured", 500

    return make_response('', 200)
Esempio n. 2
0
def update(username):
    usr = current_user._get_current_object()
    data = request.json
    if usr.username != username or username != data['username']:
        return "Silly little rabbit, this profile doesn't belong to you!", 503
    try:
        user.update(usr, **data)
    except Exception:
        # TODO :: Log that shit
        return "An unknown error occoured", 500

    return make_response('', 200)
Esempio n. 3
0
    fields = dict()
    name = request.json.get('name')
    email = request.json.get('email')
    username = request.json.get('username')

    try:
        if 'name' in request.json:
            fields['name'] = name or ''
        if 'username' in request.json:
            fields['username'] = validate_username(username)
        if 'email' in request.json:
            fields['email'] = validate_email(email)
    except ValidationError, e:
        return e.message, 403

    user.update(usr, **fields)
    return '', 201


@plan.route('/password', methods=['GET'])
@login_required
def password():
    return render_template('account/password.html')


@plan.route('/password', methods=['POST'])
@accepts('application/json')
@login_required
def password_change():
    old = request.json.get('old')
    new = request.json.get('new')
Esempio n. 4
0
    fields = dict()
    name = request.json.get('name')
    email = request.json.get('email')
    username = request.json.get('username')

    try:
        if 'name' in request.json:
            fields['name'] = name or ''
        if 'username' in request.json:
            fields['username'] = validate_username(username)
        if 'email' in request.json:
            fields['email'] = validate_email(email)
    except ValidationError, e:
        return e.message, 403

    user.update(usr, **fields)
    return '', 201


@plan.route('/password', methods=['GET'])
@login_required
def password():
    return render_template('account/password.html')


@plan.route('/password', methods=['POST'])
@accepts('application/json')
@login_required
def password_change():
    old = request.json.get('old')
    new = request.json.get('new')