Ejemplo n.º 1
0
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try: host = socket.gethostname()
    except AttributeError:
         if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
         else: host = os.environ['SERVER_NAME']
    template = LazyDict({'version': getversion(), 'host': host, 'color': Config().color or "#C54848"})
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Ejemplo n.º 2
0
Archivo: web.py Proyecto: code2u/jsb
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try: host = socket.gethostname()
    except AttributeError:
         if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
         else: host = os.environ['SERVER_NAME']
    if 'localhost' in host:  url = 'http://%s/dispatch' % host
    else: url = 'https://%s/dispatch' % host
    template = LazyDict({'url': url, 'version': getversion(), 'host': host, 'color': getmainconfig().color or "#4b7cc6"})
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Ejemplo n.º 3
0
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try:
        host = socket.gethostname()
    except AttributeError:
        if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
        else: host = os.environ['SERVER_NAME']
    template = LazyDict({
        'version': getversion(),
        'host': host,
        'color': Config().color or "#C54848"
    })
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Ejemplo n.º 4
0
 def get(self):
     try:
         cont = self.request.get('continue')
         logging.info('openid - login form %s' % cont)
         urlstring = self.create_openid_url(cont)
         template_values = LazyDict({
             'cont': cont,
             'urlstring': urlstring,
             'appname': getversion()
         })
         try: host = socket.gethostname()
         except AttributeError:
             if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
             else: host = os.environ['SERVER_NAME']
         inputdict = {'version': getversion(), 'host': host, 'loginurl': urlstring}
         template_values.update(inputdict)
         temp = os.path.join(os.getcwd(), 'templates/login.html')
         outstr = template_values.render(temp)  
         self.response.out.write(outstr)
     except Exception, ex:
         handle_exception()
Ejemplo n.º 5
0
 def get(self):
     try:
         cont = self.request.get('continue')
         logging.info('openid - login form %s' % cont)
         urlstring = self.create_openid_url(cont)
         template_values = LazyDict({
             'continue': cont,
             'urlstring': urlstring,
             'appname': getversion()
         })
         try:
             host = socket.gethostname()
         except AttributeError:
             if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
             else: host = os.environ['SERVER_NAME']
         inputdict = {'version': getversion(), 'host': host}
         template_values.update(inputdict)
         temp = os.path.join(os.getcwd(), 'templates/login.html')
         outstr = template_values.render(temp)
         self.response.out.write(outstr)
     except Exception, ex:
         handle_exception()