当前位置: 首页>>代码示例>>Python>>正文


Python web.seeother方法代码示例

本文整理汇总了Python中web.seeother方法的典型用法代码示例。如果您正苦于以下问题:Python web.seeother方法的具体用法?Python web.seeother怎么用?Python web.seeother使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在web的用法示例。


在下文中一共展示了web.seeother方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: oidc_auth

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def oidc_auth(account, issuer):
    """
    Open ID Connect Login
    :param account: Rucio account string
    :param issuer: issuer key (e.g. xdc, wlcg) as in the idpsecrets.json file
    :returns: rendered final page or a page with error message
    """

    if not account:
        account = 'webui'
    if not issuer:
        return RENDERER.problem("Please provide IdP issuer.")
    kwargs = {'audience': None,
              'auth_scope': None,
              'issuer': issuer.lower(),
              'auto': True,
              'polling': False,
              'refresh_lifetime': None,
              'ip': None,
              'webhome': ctx.realhome + '/oidc_final'}
    auth_url = auth.get_auth_oidc(account, **kwargs)
    if not auth_url:
        return RENDERER.problem("It was not possible to get the OIDC authentication url from the Rucio auth server. "
                                + "In case you provided your account name, make sure it is known to Rucio.")   # NOQA: W503
    return seeother(auth_url) 
开发者ID:rucio,项目名称:rucio,代码行数:27,代码来源:utils.py

示例2: process_callback

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def process_callback(self, auth_id):
        auth_method = self.user_manager.get_auth_method(auth_id)
        if not auth_method:
            raise web.notfound()

        auth_storage = self.user_manager.session_auth_storage().setdefault(auth_id, {})
        user = auth_method.callback(auth_storage)
        if user and auth_storage.get("method", "") == "signin":
            if not self.user_manager.bind_user(auth_id, user):
                raise web.seeother("/signin?binderror")
        elif user and auth_storage.get("method", "") == "share":
            submission = self.submission_manager.get_submission(auth_storage["submissionid"], True)
            if submission:
                course = self.course_factory.get_course(submission["courseid"])
                task = course.get_task(submission["taskid"])
                auth_method.share(auth_storage, course, task, submission, self.user_manager.session_language())
            else:
                raise web.notfound()
        else:
            raise web.seeother("/signin?callbackerror")

        raise web.seeother(auth_storage.get("redir_url", "/")) 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:24,代码来源:social.py

示例3: GET

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def GET(self, *args, **kwargs):
        """
        Checks if user is authenticated and calls GET_AUTH or performs logout.
        Otherwise, returns the login template.
        """
        if self.user_manager.session_logged_in():
            if not self.user_manager.session_username() and not self.__class__.__name__ == "ProfilePage":
                raise web.seeother("/preferences/profile")

            if not self.is_lti_page and self.user_manager.session_lti_info() is not None: #lti session
                self.user_manager.disconnect_user()
                return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods())

            return self.GET_AUTH(*args, **kwargs)
        elif self.preview_allowed(*args, **kwargs):
            return self.GET_AUTH(*args, **kwargs)
        else:
            error = ''
            if "binderror" in web.input():
                error = _("An account using this email already exists and is not bound with this service. "
                          "For security reasons, please log in via another method and bind your account in your profile.")
            if "callbackerror" in web.input():
                error = _("Couldn't fetch the required information from the service. Please check the provided "
                          "permissions (name, email) and contact your INGInious administrator if the error persists.")
            return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods(), error) 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:27,代码来源:utils.py

示例4: GET

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def GET(self):
        """
            Checks if user is authenticated and calls POST_AUTH or performs login and calls GET_AUTH.
            Otherwise, returns the login template.
        """
        data = self.user_manager.session_lti_info()
        if data is None:
            raise web.notfound()

        try:
            course = self.course_factory.get_course(data["task"][0])
            if data["consumer_key"] not in course.lti_keys().keys():
                raise Exception()
        except:
            return self.template_helper.get_renderer().lti_bind(False, "", None, "Invalid LTI data")

        user_profile = self.database.users.find_one({"ltibindings." + data["task"][0] + "." + data["consumer_key"]: data["username"]})
        if user_profile:
            self.user_manager.connect_user(user_profile["username"], user_profile["realname"], user_profile["email"], user_profile["language"])

        if self.user_manager.session_logged_in():
            raise web.seeother(self.app.get_homepath() + "/lti/task")

        return self.template_helper.get_renderer().lti_login(False) 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:26,代码来源:lti.py

示例5: POST

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def POST(self):
        login_form = self.get_login_form()
        if not login_form.validates():
            flash('error', 'form validation failed')
            return render.login(login_form)
        username = login_form['username'].value
        password = login_form['password'].value
        user = validate_user(username,password)
        if user:
            session.user = user
            web.debug(web.config.session_parameters)
            flash('success', """you are now logged in, "Add" to authorize %s""" % get_client_public_ip())
            raise web.seeother('/')
        else:
            session.user = None
            flash('error', 'login failed for user %s' % username)
            raise web.seeother('/login')
        return render.login(login_form) 
开发者ID:ab77,项目名称:netflix-proxy,代码行数:20,代码来源:auth.py

示例6: authentication

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def authentication(uid=None):
    def has_permission():
        cookies = web.cookies()
        token, user_id = cookies.get('token'), cookies.get('user_id')
        if uid and not uid == user_id:
            return False
        if not token or not user_id:
            return False
        if not auth_check(user_id, token):
            return False
        return True

    def decorator(func):
        def _decorator():
            if has_permission():
                return func
            else:
                def return_a_error():
                    return web.seeother('/login')
                return return_a_error
        return _decorator()

    return decorator 
开发者ID:RicterZ,项目名称:riXSS,代码行数:25,代码来源:authentication.py

示例7: has_obj_permission

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def has_obj_permission(obj, obj_id, url="/login", exception=False):
    def has_permission(_obj=obj, _obj_id=obj_id):
        user_id = web.cookies().get('user_id')
        if not user_id:
            return False
        if exception:
            #Exception only for view public modules.
            if int(get_detail(XSS_CORE, obj_id, 'owner')) == 0:
                return True
        if not is_owner(user_id=user_id, obj_id=_obj_id, obj_type=_obj):
            return False
        return True

    def decorator(func):
        def _decorator():
            if has_permission(obj, obj_id):
                return func
            else:
                def return_a_error():
                    return web.seeother(url)
                return return_a_error
        return _decorator()

    return decorator 
开发者ID:RicterZ,项目名称:riXSS,代码行数:26,代码来源:authentication.py

示例8: POST

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def POST(self):
    if not 'user' in session or session.user is None:
        f = register_form()
        return render.login(f)

    i = web.input(id=None, description=None)
    cluster_id = i.id
    if cluster_id is None:
      return render.error("No cluster id specified.")

    if not cluster_id.isdigit():
      return render.error("Invalid number.")
    cluster_id = int(cluster_id)

    desc = i.description
    vars = {"id":cluster_id}

    db = open_db()
    db.update('clusters', vars=vars, where="id = $id", description=desc)

    raise web.seeother("/view_cluster?id=%d" % cluster_id)

#----------------------------------------------------------------------- 
开发者ID:joxeankoret,项目名称:cosa-nostra,代码行数:25,代码来源:cosa_nostra.py

示例9: POST

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def POST(self):
        input = web.input()
        raise web.seeother('/?query=%s&tagrel=1' % input.tags) 
开发者ID:li-xirong,项目名称:jingwei,代码行数:5,代码来源:main.py

示例10: redirect_to_last_known_url

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def redirect_to_last_known_url():
    """
    Checks if there is preferred path in cookie and redirects to it.
    :returns: redirect to last known path
    """
    path = cookies().get('rucio-requested-path')
    if not path:
        path = '/'
    return seeother(path) 
开发者ID:rucio,项目名称:rucio,代码行数:11,代码来源:utils.py

示例11: authenticate

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def authenticate(rendered_tpl):
    """
    Authentication management method.
    :param rendered_tpl: rendered page template
    :returns: rendered final page or a page with error message
    """
    global AUTH_ISSUERS, SAML_SUPPORT, AUTH_TYPE, RENDERER
    valid_token_dict = validate_webui_token()
    if not valid_token_dict:
        # remember fullpath in cookie to return to after login
        setcookie('rucio-requested-path', value=unicode(ctx.fullpath), expires=120, path='/')
    else:
        return access_granted(valid_token_dict, rendered_tpl)

    # login without any known server config
    if not AUTH_TYPE:
        return RENDERER.select_login_method(AUTH_ISSUERS, SAML_SUPPORT)
    # for AUTH_TYPE predefined by the server continue
    else:
        if AUTH_TYPE == 'userpass':
            return seeother('/login')
        elif AUTH_TYPE == 'x509':
            return x509token_auth(None)
        elif AUTH_TYPE == 'x509_userpass':
            if ctx.env.get('SSL_CLIENT_VERIFY') == 'SUCCESS':
                return x509token_auth(None)
            return RENDERER.no_certificate()
        elif AUTH_TYPE == 'oidc':
            return oidc_auth(None, AUTH_ISSUER_WEBUI)
        elif AUTH_TYPE == 'saml':
            return saml_auth("GET", rendered_tpl)
        return RENDERER.problem('Invalid auth type') 
开发者ID:rucio,项目名称:rucio,代码行数:34,代码来源:utils.py

示例12: POST

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def POST(self):
    i = web.input(username="", password="")
    if i.username == "" or i.password == "":
      return render.error("Invalid username or password")
    elif i.username != NFP_USER or sha1(i.password).hexdigest() != NFP_PASS:
      return render.error("Invalid username or password")
    session.user = i.username
    return web.seeother("/")

#----------------------------------------------------------------------- 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:12,代码来源:nightmare_frontend.py

示例13: GET

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def GET(self):
    session.user = None
    del session.user
    return web.seeother("/")

#----------------------------------------------------------------------- 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:8,代码来源:nightmare_frontend.py

示例14: basic_checks

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def basic_checks(self, courseid):
        try:
            course = self.course_factory.get_course(courseid)
        except:
            raise web.notfound()

        username = self.user_manager.session_username()
        user_info = self.user_manager.get_user_info(username)

        if self.user_manager.course_is_user_registered(course, username) or not course.is_registration_possible(user_info):
            raise web.seeother(self.app.get_homepath() + "/course/" + course.get_id())

        return course, username 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:15,代码来源:course_register.py

示例15: POST_AUTH

# 需要导入模块: import web [as 别名]
# 或者: from web import seeother [as 别名]
def POST_AUTH(self, courseid):
        course, username = self.basic_checks(courseid)
        user_input = web.input()
        success = self.user_manager.course_register_user(course, username, user_input.get("register_password", None))

        if success:
            raise web.seeother(self.app.get_homepath() + "/course/" + course.get_id())
        else:
            return self.template_helper.get_renderer(use_jinja=True).course_register(course=course, error=True) 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:11,代码来源:course_register.py


注:本文中的web.seeother方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。