Exemple #1
0
    def GET_shib_login(self, dest):
        def get_valid_local_part(email):
            if not email or len(email.split('@')) != 2:
                return False
            local, domain = email.split('@')
            if domain != 'mit.edu':
                return False
            return local

        def parse_GET(query_string):
            GET = {}
            args = query_string.split('&')
            for arg in args:
                t = arg.split('=')
                if len(t) != 2:
                    continue
                k, v = t
                GET[k] = v
            return GET

        test = {}
        user = get_valid_local_part(request.environ['HTTP_REMOTE_USER'])
        affiliation = request.environ['HTTP_AFFILIATION']
        if affiliation and len(affiliation.split(';')) > 1:
            affiliation = affiliation.split(';')[0]
        affiliation = get_valid_local_part(affiliation)
        GET = parse_GET(request.environ['QUERY_STRING'])
        # destination = '%2F'
        # if 'dest' in GET:
        #     destination = GET['dest']
        # destination = unquote(destination).decode('utf8')
        ApiController._handle_shib_login(self, user, affiliation)
        return self.redirect(dest)
Exemple #2
0
    def POST_reg(self, dest, *a, **kw):
        ApiController._handle_register(self, *a, **kw)
        c.render_style = "html"
        response.content_type = "text/html"

        if c.errors:
            return LoginPage(user_reg = request.POST.get('user'),
                             dest = dest).render()

        return self.hsts_redirect(dest)
Exemple #3
0
    def POST_login(self, dest, *a, **kw):
        ApiController._handle_login(self, *a, **kw)
        c.render_style = "html"
        c.response_content_type = ""

        if c.errors:
            return LoginPage(user_login = request.post.get('user'),
                             dest = dest).render()

        return self.redirect(dest)
Exemple #4
0
    def POST_reg(self, dest, *a, **kw):
        ApiController._handle_register(self, *a, **kw)
        c.render_style = "html"
        response.content_type = "text/html"

        if c.errors:
            return LoginPage(user_reg=request.POST.get('user'),
                             dest=dest).render()

        return self.redirect(dest)
Exemple #5
0
    def POST_login(self, dest, *a, **kw):
        ApiController._handle_login(self, *a, **kw)
        c.render_style = "html"
        c.response_content_type = ""

        if c.errors:
            return LoginPage(user_login=request.post.get('user'),
                             dest=dest).render()

        return self.redirect(dest)
Exemple #6
0
    def POST_login(self, dest, *a, **kw):
        ApiController._handle_login(self, *a, **kw)
        c.render_style = "html"
        response.content_type = "text/html"

        if c.errors:
            return LoginPage(user_login = request.POST.get('user'),
                             dest = dest).render()

        if hsts_eligible():
            dest = hsts_modify_redirect(dest)
        return self.redirect(dest)
Exemple #7
0
    def POST_login(self, dest, *a, **kw):
        ApiController._handle_login(self, *a, **kw)
        c.render_style = "html"
        response.content_type = "text/html"

        if c.errors:
            return LoginPage(user_login=request.POST.get('user'),
                             dest=dest).render()

        if hsts_eligible():
            dest = hsts_modify_redirect(dest)
        return self.redirect(dest)
Exemple #8
0
    def __init__(self, session, path=""):
        BaseController.__init__(self, path)
        self.session = session
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))
        self.putChild("file", FileController(session))
        self.putChild("grab", grabScreenshot(session))
        self.putChild("mobile", MobileController(session))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("static", static.File(getPublicPath() + "/static"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        self.putChild("ipkg", IpkgController(session))
        self.putChild("autotimer", ATController(session))
        self.putChild("serienrecorder", SRController(session))
        self.putChild("epgrefresh", ERController(session))
        self.putChild("bouqueteditor", BQEController(session))
        self.putChild("transcoding", TranscodingController(session))
        self.putChild("wol", WOLClientController(session))
        self.putChild("wolsetup", WOLSetupController(session))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #9
0
	def __init__(self, session, path = ""):
		BaseController.__init__(self, path)
		self.session = session
		self.controller = None

		self.putChild("control", WebController(session))
		self.putChild("ajax", AjaxController(session))
		self.putChild("api", ApiController(session))
		self.putChild("js", static.File(getPublicPath() + "/js"))
		self.putChild("css", static.File(getPublicPath() + "/css"))
		self.putChild("images", static.File(getPublicPath() + "/images"))
    def __init__(self, session, path=""):
        BaseController.__init__(self, path)
        self.session = session
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))
        self.putChild("file", FileController(session))
        self.putChild("grab", grabScreenshot(session))
        self.putChild("mobile", MobileController(session))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #11
0
    def POST_reg(self, dest, *a, **kw):
        ApiController.POST_register(self, *a, **kw)
        c.render_style = "html"
        c.response_content_type = ""

        errors = list(c.errors)
        if errors:
            for e in errors:
                if not e[0].endswith("_reg"):
                    msg = c.errors[e].message
                    c.errors.remove(e)
                    c.errors.add(e[0], msg)
            return LoginPage(user_reg=request.post.get('user'),
                             dest=dest).render()

        return self.redirect(dest)
    def __init__(self, session, path=""):
        BaseController.__init__(self, path=path, session=session)
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))

        encoder_factory = rest_fs_access.GzipEncodeByFileExtensionFactory(
            extensions=[
                'txt', 'json', 'html', 'xml', 'js', 'conf', 'cfg', 'eit', 'sc',
                'ap'
            ])
        #: gzip compression enabled file controller
        wrapped_fs_controller = EncodingResourceWrapper(
            rest_fs_access.FileController(root='/',
                                          resource_prefix="/file",
                                          session=session), [encoder_factory])
        self.putChild("file", wrapped_fs_controller)
        self.putChild("grab", grabScreenshot(session))
        if os.path.exists(getPublicPath('mobile')):
            self.putChild("mobile", MobileController(session))
            self.putChild("m", static.File(getPublicPath() + "/mobile"))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("static", static.File(getPublicPath() + "/static"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        self.putChild("fonts", static.File(getPublicPath() + "/fonts"))
        if os.path.exists(getPublicPath('themes')):
            self.putChild("themes", static.File(getPublicPath() + "/themes"))
        if os.path.exists(getPublicPath('webtv')):
            self.putChild("webtv", static.File(getPublicPath() + "/webtv"))
        if os.path.exists(getPublicPath('vxg')):
            self.putChild("vxg", static.File(getPublicPath() + "/vxg"))
        if os.path.exists('/usr/bin/shellinaboxd'):
            self.putChild("terminal",
                          proxy.ReverseProxyResource('::1', 4200, '/'))
        self.putChild("ipkg", IpkgController(session))
        self.putChild("autotimer", ATController(session))
        self.putChild("serienrecorder", SRController(session))
        self.putChild("epgrefresh", ERController(session))
        self.putChild("bouqueteditor", BQEController(session))
        self.putChild("transcoding", TranscodingController())
        self.putChild("wol", WOLClientController())
        self.putChild("wolsetup", WOLSetupController(session))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #13
0
    def POST_reg(self, *a, **kw):
        res = ApiController.POST_register(self, *a, **kw)
        c.render_style = "html"
        c.response_content_type = ""

        errors = list(c.errors)
        if errors:
            for e in errors:
                if not e.endswith("_reg"):
                    msg = c.errors[e].message
                    c.errors.remove(e)
                    c.errors._add(e + "_reg", msg)

            dest = request.post.get('dest', request.referer or '/')
            return LoginPage(user_reg=request.post.get('user_reg'),
                             dest=dest).render()

        return self.redirect(res.redirect)
Exemple #14
0
	def __init__(self, session, path = ""):
		BaseController.__init__(self, path)
		self.session = session
		piconpath = getPiconPath()

		self.putChild("web", WebController(session))
		self.putChild("api", ApiController(session))
		self.putChild("ajax", AjaxController(session))
		self.putChild("file", FileController(session))
		self.putChild("grab", grabScreenshot(session))
		if os.path.exists(getPublicPath('mobile')):
			self.putChild("mobile", MobileController(session))
			self.putChild("m", static.File(getPublicPath() + "/mobile"))
		self.putChild("js", static.File(getPublicPath() + "/js"))
		self.putChild("css", static.File(getPublicPath() + "/css"))
		self.putChild("static", static.File(getPublicPath() + "/static"))
		self.putChild("images", static.File(getPublicPath() + "/images"))
		self.putChild("fonts", static.File(getPublicPath() + "/fonts"))
		if os.path.exists(getPublicPath('themes')):
			self.putChild("themes", static.File(getPublicPath() + "/themes"))
		if os.path.exists(getPublicPath('webtv')):
			self.putChild("webtv", static.File(getPublicPath() + "/webtv"))
		if os.path.exists(getPublicPath('vxg')):
			self.putChild("vxg", static.File(getPublicPath() + "/vxg"))
		if os.path.exists('/usr/bin/shellinaboxd'):
			self.putChild("terminal", proxy.ReverseProxyResource('::1', 4200, '/'))
		self.putChild("ipkg", IpkgController(session))
		self.putChild("autotimer", ATController(session))
		self.putChild("serienrecorder", SRController(session))
		self.putChild("epgrefresh", ERController(session))
		self.putChild("bouqueteditor", BQEController(session))
		self.putChild("transcoding", TranscodingController(session))
		self.putChild("wol", WOLClientController(session))
		self.putChild("wolsetup", WOLSetupController(session))
		if piconpath:
			self.putChild("picon", static.File(piconpath))