Exemple #1
0
def reset_teamspeak3_perm(request):
    logger.debug("reset_teamspeak3_perm called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    logger.debug("Deleting TS3 user for user %s" % request.user)
    Teamspeak3Manager.delete_user(authinfo.teamspeak3_uid)

    if check_if_user_has_permission(request.user, "blue_member"):
        logger.debug("Generating new permission key for blue user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_blue_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                                   character.corporation_ticker)
    else:
        logger.debug("Generating new permission key for user %s with main character %s" % (request.user, character))
        result = Teamspeak3Manager.generate_new_permissionkey(authinfo.teamspeak3_uid, character.character_name,
                                                              character.corporation_ticker)

    # if blank we failed
    if result != "":
        AuthServicesInfoManager.update_user_teamspeak3_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with TS3 credentials. Updating groups." % request.user)
        update_teamspeak3_groups.delay(request.user)
        logger.info("Successfully reset TS3 permission key for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to reset TS3 permission key for user %s" % request.user)
    return HttpResponseRedirect("/")
Exemple #2
0
def verify_teamspeak3(request):
    logger.debug("verify_teamspeak3 called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    if not authinfo.teamspeak3_uid:
        logger.warn("Unable to validate user %s teamspeak: no teamspeak data" % request.user)
        return HttpResponseRedirect("/services")
    if request.method == "POST":
        form = TeamspeakJoinForm(request.POST)
        if form.is_valid():
            update_teamspeak3_groups.delay(request.user.pk)
            logger.debug("Validated user %s joined TS server")
            return HttpResponseRedirect("/services/")
    else:
        form = TeamspeakJoinForm({'username':authinfo.teamspeak3_uid})
    context = {
        'form': form,
        'authinfo': authinfo,
    }
    return render_to_response('registered/teamspeakjoin.html', context, context_instance=RequestContext(request))