コード例 #1
0
def set_forum_password(request):
    logger.debug("set_forum_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 = Phpbb3Manager.update_user_password(authinfo.forum_username, authinfo.main_char_id, password=password)
            if result != "":
                AuthServicesInfoManager.update_user_forum_info(authinfo.forum_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 forum 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': 'Forum'}
    return render_to_response('registered/service_password.html', context, context_instance=RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: Tuqiri/allianceauth
def set_forum_password(request):
    logger.debug("set_forum_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 = Phpbb3Manager.update_user_password(authinfo.forum_username, authinfo.main_char_id, password=password)
            if result != "":
                AuthServicesInfoManager.update_user_forum_info(authinfo.forum_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 forum 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': 'Forum'}
    return render_to_response('registered/service_password.html', context, context_instance=RequestContext(request))
コード例 #3
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def reset_forum_password(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.update_user_password(authinfo.forum_username)
    # false we failed
    if result != "":
        AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username, result, request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #4
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def deactivate_forum(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.disable_user(authinfo.forum_username)
    remove_all_syncgroups_for_service(request.user, "phpbb")
    # false we failed
    if result:
        AuthServicesInfoManager.update_user_forum_info("", "", request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #5
0
def reset_forum_password(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.update_user_password(authinfo.forum_username)
    # false we failed
    if result != "":
        AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username,
                                                       result, request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #6
0
def deactivate_forum(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.disable_user(authinfo.forum_username)
    remove_all_syncgroups_for_service(request.user, "phpbb")
    # false we failed
    if result:
        AuthServicesInfoManager.update_user_forum_info("", "", request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #7
0
ファイル: views.py プロジェクト: Tuqiri/allianceauth
def reset_forum_password(request):
    logger.debug("reset_forum_password called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.update_user_password(authinfo.forum_username, authinfo.main_char_id)
    # false we failed
    if result != "":
        AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username, result, request.user)
        logger.info("Succesfully reset forum password for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to reset forum password for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #8
0
def reset_forum_password(request):
    logger.debug("reset_forum_password called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.update_user_password(authinfo.forum_username, authinfo.main_char_id)
    # false we failed
    if result != "":
        AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username, result, request.user)
        logger.info("Succesfully reset forum password for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccessful attempt to reset forum password for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #9
0
def deactivate_forum(request):
    logger.debug("deactivate_forum called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    result = Phpbb3Manager.disable_user(authinfo.forum_username)
    # false we failed
    if result:
        AuthServicesInfoManager.update_user_forum_info("", "", request.user)
        logger.info("Succesfully deactivated forum for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccesful attempt to activate forum for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #10
0
ファイル: views.py プロジェクト: tankbusta/allianceauth
def activate_forum(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    # Valid now we get the main characters
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    result = Phpbb3Manager.add_user(character.character_name, request.user.email, ['REGISTERED'])
    # if empty we failed
    if result[0] != "":
        AuthServicesInfoManager.update_user_forum_info(result[0], result[1], request.user)
        update_forum_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #11
0
def activate_forum(request):
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    # Valid now we get the main characters
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    result = Phpbb3Manager.add_user(character.character_name,
                                    request.user.email, ['REGISTERED'])
    # if empty we failed
    if result[0] != "":
        AuthServicesInfoManager.update_user_forum_info(result[0], result[1],
                                                       request.user)
        update_forum_groups(request.user)
        return HttpResponseRedirect("/services/")
    return HttpResponseRedirect("/dashboard")
コード例 #12
0
ファイル: views.py プロジェクト: Tuqiri/allianceauth
def activate_forum(request):
    logger.debug("activate_forum called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    # Valid now we get the main characters
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    logger.debug("Adding phpbb user for user %s with main character %s" % (request.user, character))
    result = Phpbb3Manager.add_user(character.character_name, request.user.email, ['REGISTERED'], authinfo.main_char_id)
    # if empty we failed
    if result[0] != "":
        AuthServicesInfoManager.update_user_forum_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with forum credentials. Updating groups." % request.user)
        update_forum_groups(request.user)
        logger.info("Succesfully activated forum for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccesful attempt to activate forum for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")
コード例 #13
0
def activate_forum(request):
    logger.debug("activate_forum called by user %s" % request.user)
    authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
    # Valid now we get the main characters
    character = EveManager.get_character_by_id(authinfo.main_char_id)
    logger.debug("Adding phpbb user for user %s with main character %s" % (request.user, character))
    result = Phpbb3Manager.add_user(character.character_name, request.user.email, ['REGISTERED'], authinfo.main_char_id)
    # if empty we failed
    if result[0] != "":
        AuthServicesInfoManager.update_user_forum_info(result[0], result[1], request.user)
        logger.debug("Updated authserviceinfo for user %s with forum credentials. Updating groups." % request.user)
        update_forum_groups.delay(request.user.pk)
        logger.info("Succesfully activated forum for user %s" % request.user)
        return HttpResponseRedirect("/services/")
    logger.error("Unsuccesful attempt to activate forum for user %s" % request.user)
    return HttpResponseRedirect("/dashboard")