@ajax_request
@login_required
def set_password(request):
    """sets/updates a user's password, follows the min requiremnent of
    django-passwords settings in BE/settings/common.py

    :PUT: {
            'current_password': current_password,
            'password_1': password_1,
            'password_2': password_2
    }

    Returns::

        {
            'status': 'success'
        }
    """
    default_validators = [
        validate_length, common_sequences, dictionary_words, complexity
    ]
    if request.method != 'PUT':
        return {'status': 'error', 'message': 'only HTTP PUT allowed'}
    body = json.loads(request.body)
    current_password = body.get('current_password')
    p1 = body.get('password_1')
    p2 = body.get('password_2')
    if not request.user.check_password(current_password):
        return {'status': 'error', 'message': 'current password is not valid'}
    if p1 is None or p1 != p2:
        return {'status': 'error', 'message': 'entered password do not match'}
    # validate password from django-password settings
    for validator in default_validators:
        try:
            validator(p2)
        except __HOLE__, e:
            return {'status': 'error', 'message': e.message}
    request.user.set_password(p1)
    request.user.save()
    return {'status': 'success'}
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/views/accounts.py/set_password