コード例 #1
0
    def request(self):
        # check for login
        request = server.request(web.ctx.homedomain + web.url('/endpoint'), self.query)
        try:
            response = request.process(session.logged_in)

        except OpenIDResponse.NoneRequest:
            return web.badrequest()

        if self.query.get('logged_in', False):
            session.logout()


        return render_openid_to_response(response)
コード例 #2
0
    def request(self):
        # check for login
        request = server.request(web.ctx.homedomain + web.url('/endpoint'), self.query)
        try:
            response = request.process(session.logged_in)

        except OpenIDResponse.NoneRequest:
            return web.badrequest()

        except OpenIDResponse.LogInNeed:
            # redirect request to login form
            return WebOpenIDLoginRequired(self.query)

        except OpenIDResponse.DecisionNeed:
            # redirect request to decision page in restricted area
            return web.found(web.ctx.homedomain + web.url('/account/decision', **self.query))

        if self.query.get('logged_in', False):
            session.logout()


        return render_openid_to_response(response)
コード例 #3
0
    def request(self):
        # check for login
        request = server.request(
            _secure_homedomain(web.ctx) + web.url('/endpoint'), self.query)
        try:
            response = request.process(session.logged_in)

        except OpenIDResponse.NoneRequest:
            return web.badrequest()

        except OpenIDResponse.LogInNeed:
            # redirect request to login form
            return WebOpenIDLoginRequired(self.query)

        except OpenIDResponse.DecisionNeed:
            # redirect request to decision page in restricted area
            return web.found(
                _secure_homedomain(web.ctx) +
                web.url('/account/decision', **self.query))

        if self.query.get('logged_in', False):
            session.logout()

        return render_openid_to_response(response)
コード例 #4
0
    def request(self):
        # check for login
        if not session.logged_in:
            return WebOpenIDLoginRequired(self.query)

        request = server.request(web.ctx.homedomain + web.url('/endpoint'), self.query)

        try:
            response = request.process(logged_in=True)

        except OpenIDResponse.NoneRequest:
            return web.badrequest()

        except OpenIDResponse.DecisionNeed:

            if self.method == 'POST':
                if self.query.get('logout', False):
                    session.logout()

                if self.query.has_key('approve'):
                    response = request.approve()
                elif self.query.has_key('always'):
                    response = request.always()
                else:
                    response = request.decline()

            else:
                data = filter(
                        lambda item: item[0] not in [
                                'approve', 'always',
                                'logged_in', 'logout'
                            ],
                        self.query.items())

                sreg_request = sreg.SRegRequest.fromOpenIDRequest(request.request)

                profile = None
                if sreg_request.required or sreg_request.optional:
                    try:
			hcards = HCardParser().parse_url(request.request.identity)
			if hcards:
			    hcard = hcards.next()
			    profile = hcard.profile(sreg_request.required, sreg_request.optional)
                    except:
                        pass

                logout_form = WebOpenIDLogoutForm()
                logout_form.fill({'logout': self.query.get('logged_in', False)})

                web.header('Content-type', 'text/html')
                return render.verify(
                        logged_in=session.logged_in,
                        logout_url=web.ctx.homedomain + web.url('/account/logout'),
                        change_password_url=web.ctx.homedomain + web.url('/account/change_password'),
                        no_password=session.get('no_password', False),
                        decision_url=web.ctx.homedomain + web.url('/account/decision'),
                        identity=request.request.identity,
                        trust_root=request.request.trust_root,
                        profile=profile,
                        logout_form=logout_form,
                        query=data,
                    )

        return render_openid_to_response(response)
コード例 #5
0
 def request(self):
     session.logout()
     return web.found(web.ctx.homedomain + web.url('/account/login'))
コード例 #6
0
 def request(self):
     session.logout()
     return web.found(_secure_homedomain(web.ctx) + web.url('/account/login'))
コード例 #7
0
    def request(self):
        # check for login
        if not session.logged_in:
            return WebOpenIDLoginRequired(self.query)

        request = server.request(
            _secure_homedomain(web.ctx) + web.url('/endpoint'), self.query)

        try:
            response = request.process(logged_in=True)

        except OpenIDResponse.NoneRequest:
            return web.badrequest()

        except OpenIDResponse.DecisionNeed:

            if self.method == 'POST':
                if self.query.get('logout', False):
                    session.logout()

                if self.query.has_key('approve'):
                    response = request.approve()
                elif self.query.has_key('always'):
                    response = request.always()
                else:
                    response = request.decline()

            else:
                data = filter(
                    lambda item: item[0] not in
                    ['approve', 'always', 'logged_in', 'logout'],
                    self.query.items())

                sreg_request = sreg.SRegRequest.fromOpenIDRequest(
                    request.request)

                profile = None
                if sreg_request.required or sreg_request.optional:
                    try:
                        hcards = HCardParser().parse_url(
                            request.request.identity)
                        if hcards:
                            hcard = hcards.next()
                            profile = hcard.profile(sreg_request.required,
                                                    sreg_request.optional)
                    except:
                        pass

                logout_form = WebOpenIDLogoutForm()
                logout_form.fill(
                    {'logout': self.query.get('logged_in', False)})

                web.header('Content-type', 'text/html')
                return render.verify(
                    home_url=_secure_homedomain(web.ctx) + web.url('/'),
                    logged_in=session.logged_in,
                    logout_url=_secure_homedomain(web.ctx) +
                    web.url('/account/logout'),
                    change_password_url=_secure_homedomain(web.ctx) +
                    web.url('/account/change_password'),
                    no_password=session.get('no_password', False),
                    decision_url=_secure_homedomain(web.ctx) +
                    web.url('/account/decision'),
                    identity=request.request.identity,
                    trust_root=request.request.trust_root,
                    profile=profile,
                    logout_form=logout_form,
                    query=data,
                )

        return render_openid_to_response(response)
コード例 #8
0
 def request(self):
     session.logout()
     return web.found(
         _secure_homedomain(web.ctx) + web.url('/account/login'))
コード例 #9
0
 def request(self):
     session.logout()
     return web.found(publichomedomain() + web.url('/account/login'))