Exemple #1
0
def activate_mumble(request):
    logger.debug("activate_mumble called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug(
            "Adding mumble user for blue user %s with main character %s" %
            (request.user, character))
        result = MumbleManager.create_blue_user(character.corporation_ticker,
                                                character.character_name)
    else:
        logger.debug("Adding mumble user for user %s with main character %s" %
                     (request.user, character))
        result = MumbleManager.create_user(character.corporation_ticker,
                                           character.character_name)
    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_mumble_info(
            result[0], result[1], request.user)
        logger.debug(
            "Updated authserviceinfo for user %s with mumble credentials. Updating groups."
            % request.user)
        update_mumble_groups(request.user)
        logger.info("Succesfully activated mumble for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to activate mumble for user %s" %
                 request.user)
    return HttpResponseRedirect("/dashboard")
Exemple #2
0
def activate_mumble(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        result = MumbleManager.create_blue_user(character.corporation_ticker, character.character_name)
    else:
        result = MumbleManager.create_user(character.corporation_ticker, character.character_name)
    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_mumble_info(result[0], result[1], request.user)
        update_mumble_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
Exemple #3
0
def set_mumble_password(request):
    logger.debug("set_mumble_password called by user %s" % request.user)
    error = None
    if request.method == 'POST':
        logger.debug("Received POST request with form.")
        form = ServicePasswordForm(request.POST)
        logger.debug("Form is valid: %s" % form.is_valid())
        if form.is_valid():
            password = form.cleaned_data['password']
            authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
            result = MumbleManager.update_user_password(authinfo.mumble_username, password=password)
            if result != "":
                AuthServicesInfoManager.update_user_mumble_info(authinfo.mumble_username, result, request.user)
                logger.info("Succesfully reset forum password for user %s" % request.user)
                return HttpResponseRedirect("/services/")
            else:
                logger.error("Failed to install custom mumble password for user %s" % request.user)
                error = "Failed to install custom password."
        else:
            error = "Invalid password provided"
    else:
        logger.debug("Request is not type POST - providing empty form.")
        form = ServicePasswordForm()

    logger.debug("Rendering form for user %s" % request.user)
    context = {'form': form, 'service': 'Mumble', 'error': error}
    return render_to_response('registered/service_password.html', context, context_instance=RequestContext(request))
Exemple #4
0
def set_mumble_password(request):
    logger.debug("set_mumble_password called by user %s" % request.user)
    error = None
    if request.method == 'POST':
        logger.debug("Received POST request with form.")
        form = ServicePasswordForm(request.POST)
        logger.debug("Form is valid: %s" % form.is_valid())
        if form.is_valid():
            password = form.cleaned_data['password']
            logger.debug("Form contains password of length %s" % len(password))
            authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
            result = MumbleManager.update_user_password(authinfo.mumble_username, password=password)
            if result != "":
                AuthServicesInfoManager.update_user_mumble_info(authinfo.mumble_username, result, request.user)
                logger.info("Succesfully reset forum password for user %s" % request.user)
                return HttpResponseRedirect("/services/")
            else:
                logger.error("Failed to install custom mumble password for user %s" % request.user)
                error = "Failed to install custom password."
        else:
            error = "Invalid password provided"
    else:
        logger.debug("Request is not type POST - providing empty form.")
        form = ServicePasswordForm()

    logger.debug("Rendering form for user %s" % request.user)
    context = {'form': form, 'service': 'Mumble', 'error': error}
    return render_to_response('registered/service_password.html', context, context_instance=RequestContext(request))
Exemple #5
0
def activate_mumble(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        result = MumbleManager.create_blue_user(character.corporation_ticker,
                                                character.character_name)
    else:
        result = MumbleManager.create_user(character.corporation_ticker,
                                           character.character_name)
    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_mumble_info(
            result[0], result[1], request.user)
        update_mumble_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
Exemple #6
0
def reset_mumble_password(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.update_user_password(authinfo.mumble_username)
    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_mumble_info(authinfo.mumble_username, result, request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
Exemple #7
0
def deactivate_blue_mumble(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.delete_user(authinfo.mumble_username)
    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_mumble_info("", "", request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
Exemple #8
0
def deactivate_mumble(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.delete_user(authinfo.mumble_username)
    remove_all_syncgroups_for_service(request.user, "mumble")
    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_mumble_info("", "", request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
Exemple #9
0
def activate_mumble(request):
    logger.debug("activate_mumble called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug("Adding mumble user for blue user %s with main character %s" % (request.user, character))
        result = MumbleManager.create_blue_user(character.corporation_ticker, character.character_name)
    else:
        logger.debug("Adding mumble user for user %s with main character %s" % (request.user, character))
        result = MumbleManager.create_user(character.corporation_ticker, character.character_name)
    # if its empty we failed
    if result[0] is not "":
        AuthServicesInfoManager.update_user_mumble_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with mumble credentials. Updating groups." % request.user)
        update_mumble_groups(request.user)
        logger.info("Succesfully activated mumble for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to activate mumble for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
Exemple #10
0
def reset_mumble_password(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.update_user_password(authinfo.mumble_username)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_mumble_info(
            authinfo.mumble_username, result, request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/")
Exemple #11
0
def deactivate_mumble(request):
    logger.debug("deactivate_mumble called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.delete_user(authinfo.mumble_username)
    # if false we failed
    if result:
        AuthServicesInfoManager.update_user_mumble_info("", "", request.user)
        logger.info("Succesfully deactivated mumble for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to deactivate mumble for user %s" % request.user)
    return HttpResponseRedirect("/")
Exemple #12
0
def reset_mumble_password(request):
    logger.debug("reset_mumble_password called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.update_user_password(authinfo.mumble_username)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_mumble_info(authinfo.mumble_username, result, request.user)
        logger.info("Succesfully reset mumble password for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccesful attempt to reset mumble password for user %s" % request.user)
    return HttpResponseRedirect("/")
Exemple #13
0
def reset_mumble_password(request):
    logger.debug("reset_mumble_password called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = MumbleManager.update_user_password(authinfo.mumble_username)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_mumble_info(authinfo.mumble_username, result, request.user)
        logger.info("Succesfully reset mumble password for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccesful attempt to reset mumble password for user %s" % request.user)
    return HttpResponseRedirect("/")