Exemplo n.º 1
0
 def __init__(self):
     site_info = reader.get_site_setting()
     if site_info == None:
         site_info = site_setting()
         site_info.site_name = 'demo'
         site_info.site_slogan = ''
         site_info.author = 'chimchar'
         site_info.google_analytic_id = ''
         writer.set_site_setting(site_info)
     site_info.site_domain = web.ctx.host
     self.site_info = site_info
Exemplo n.º 2
0
 def GET(self):
     site_info = reader.get_site_setting()
     if site_info == None:
         site_info = site_setting()
         site_info.site_name = 'demo'
         site_info.site_slogan = ''
         site_info.author = 'chimchar'
         site_info.google_analytic_id = ''
         writer.set_site_setting(site_info)
     site_info.site_domain = web.ctx.host
     template_values = {
             'site_info': site_info
             }
     path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer')
     return template_render('auth.html', path, template_values)
Exemplo n.º 3
0
    def POST(self):
        site_info = reader.get_site_setting()
        if site_info == None:
            site_info = site_setting()
            site_info.site_name = 'demo'
            site_info.site_slogan = ''
            site_info.author = 'chimchar'
            site_info.google_analytic_id = ''
            writer.set_site_setting(site_info)
        site_info.site_domain = web.ctx.host
        template_values = {
                'site_info': site_info
                }
        path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer')

        pwd = web.input().passwd
        sha1 = hashlib.sha1(pwd).hexdigest()
        if (sha1 == SECRET):
            web.setcookie('is_pass', sha1, 3600)
            web.redirect('/overview')
        else:
            template_values['message'] = 'Secret pharse WRONG!'
            return template_render('auth.html', path, template_values)