示例#1
0
文件: user.py 项目: Weasyl/weasyl
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        return Response(define.errorpage(request.userid, errorcode.token), status=403)

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
示例#2
0
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        raise WeasylError('token')

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
示例#3
0
def common_status_page(userid, status):
    """
    Raise the redirect to the script returned by common_status_check() or render
    the appropriate site status error page.
    """
    if status in ('banned', 'suspended'):
        from weasyl import moderation, login

        login.signout(get_current_request())
        if status == 'banned':
            reason = moderation.get_ban_reason(userid)
            return errorpage(
                userid,
                "Your account has been permanently banned and you are no longer allowed "
                "to sign in.\n\n%s\n\nIf you believe this ban is in error, please "
                "contact %s for assistance." % (reason, MACRO_SUPPORT_ADDRESS))

        elif status == 'suspended':
            suspension = moderation.get_suspension(userid)
            return errorpage(
                userid,
                "Your account has been temporarily suspended and you are not allowed to "
                "be logged in at this time.\n\n%s\n\nThis suspension will be lifted on "
                "%s.\n\nIf you believe this suspension is in error, please contact "
                "%s for assistance." % (suspension.reason, convert_date(suspension.release), MACRO_SUPPORT_ADDRESS))
示例#4
0
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        return Response(define.errorpage(request.userid, errorcode.token))

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
示例#5
0
文件: user.py 项目: dzamie/weasyl
    def GET(self):
        if api.is_api_user():
            raise web.webapi.Forbidden()
        if web.input(token="").token != define.get_token()[:8]:
            return define.errorpage(self.user_id, errorcode.token)

        login.signout(self.user_id)

        raise web.seeother("/index")
示例#6
0
    def GET(self):
        if api.is_api_user():
            raise web.webapi.Forbidden()
        if web.input(token="").token != define.get_token()[:8]:
            return define.errorpage(self.user_id, errorcode.token)

        login.signout(self.user_id)

        raise web.seeother("/index")
示例#7
0
文件: define.py 项目: taedixon/weasyl
def common_status_page(userid, status):
    """
    Raise the redirect to the script returned by common_status_check() or render
    the appropriate site status error page.
    """
    if status == "admin":
        return errorpage(0, errorcode.admin_mode)
    elif status == "local":
        return errorpage(0, errorcode.local_mode)
    elif status == "offline":
        return errorpage(0, errorcode.offline_mode)
    elif status == "address":
        return "IP ADDRESS TEMPORARILY REJECTED"
    elif status == "resetpassword":
        return webpage(userid, "force/resetpassword.html")
    elif status == "resetbirthday":
        return webpage(userid, "force/resetbirthday.html")
    elif status == "resetemail":
        return "reset email"  # todo
    elif status in ('banned', 'suspended'):
        from weasyl import moderation, login

        login.signout(get_current_request())
        if status == 'banned':
            reason = moderation.get_ban_reason(userid)
            return errorpage(
                userid,
                "Your account has been permanently banned and you are no longer allowed "
                "to sign in.\n\n%s\n\nIf you believe this ban is in error, please "
                "contact [email protected] for assistance." % (reason, ))

        elif status == 'suspended':
            suspension = moderation.get_suspension(userid)
            return errorpage(
                userid,
                "Your account has been temporarily suspended and you are not allowed to "
                "be logged in at this time.\n\n%s\n\nThis suspension will be lifted on "
                "%s.\n\nIf you believe this suspension is in error, please contact "
                "[email protected] for assistance." %
                (suspension.reason, convert_date(suspension.release)))
示例#8
0
文件: define.py 项目: hyena/weasyl
def common_status_page(userid, status):
    """
    Raise the redirect to the script returned by common_status_check() or render
    the appropriate site status error page.
    """
    if status == "admin":
        return errorpage(0, errorcode.admin_mode)
    elif status == "local":
        return errorpage(0, errorcode.local_mode)
    elif status == "offline":
        return errorpage(0, errorcode.offline_mode)
    elif status == "address":
        return "IP ADDRESS TEMPORARILY REJECTED"
    elif status == "resetpassword":
        return webpage(userid, "force/resetpassword.html")
    elif status == "resetbirthday":
        return webpage(userid, "force/resetbirthday.html")
    elif status == "resetemail":
        return "reset email"  # todo
    elif status in ('banned', 'suspended'):
        from weasyl import moderation, login

        login.signout(userid)
        if status == 'banned':
            reason = moderation.get_ban_reason(userid)
            return errorpage(
                userid,
                "Your account has been permanently banned and you are no longer allowed "
                "to sign in.\n\n%s\n\nIf you believe this ban is in error, please "
                "contact [email protected] for assistance." % (reason,))

        elif status == 'suspended':
            suspension = moderation.get_suspension(userid)
            return errorpage(
                userid,
                "Your account has been temporarily suspended and you are not allowed to "
                "be logged in at this time.\n\n%s\n\nThis suspension will be lifted on "
                "%s.\n\nIf you believe this suspension is in error, please contact "
                "[email protected] for assistance." % (suspension.reason, convert_date(suspension.release)))