Пример #1
0
 def GET(self):
     referer = web.ctx.env.get('HTTP_REFERER', '/')
     i = web.input(redirect=referer)
     form = forms.loginform()
     form['redirect'].value = i.redirect
     msg, msg_type = helpers.get_delete_msg()
     return render.login(form, msg)
Пример #2
0
def do_login(email, state):
    lf, sf = forms.loginform(), forms.signupform()
    lf.fill(useremail=email,
            redirect=state['redirect'],
            state=json.dumps(state))
    sf.fill(redirect=state['redirect'], state=state)
    return render.login(lf, sf)
Пример #3
0
 def GET(self):
     referer = web.ctx.env.get('HTTP_REFERER', '/')
     i = web.input(redirect=referer)
     lf, sf= forms.loginform(), forms.signupform()
     lf.fill(i)
     sf['redirect'].value = sf['redirect'].value = i.redirect
     msg, msg_type = helpers.get_delete_msg()
     return render.login(lf, sf, msg, i.redirect)
Пример #4
0
 def GET(self):
     referer = web.ctx.env.get('HTTP_REFERER', '/')
     i = web.input(redirect=referer)
     lf, sf = forms.loginform(), forms.signupform()
     lf.fill(i)
     sf['redirect'].value = sf['redirect'].value = i.redirect
     msg, msg_type = helpers.get_delete_msg()
     return render.login(lf, sf, msg, i.redirect)
Пример #5
0
 def POST(self):
     i = web.input(redirect='/')
     user = _login(i.useremail, i.password)
     if not user:
         f = forms.loginform()
         f.fill(i)
         f.note = 'Invalid email or password.'
         return render.login(f)
     raise web.seeother(i.redirect)
Пример #6
0
 def POST(self):
     i = web.input(redirect='/')
     sf = forms.signupform()
     if not sf.validates(i):
         lf = forms.loginform()
         lf['redirect'].value = sf['redirect'].value = i.redirect
         sf.fill(i)
         return render.login(lf, sf, redirect=i.redirect)
     user = new_user(i.email, i.password)
     helpers.set_login_cookie(i.email)
     raise web.seeother(i.redirect, absolute=True)
Пример #7
0
 def POST(self):
     i = web.input(redirect='/')
     sf = forms.signupform()
     if not sf.validates(i):
         lf = forms.loginform()
         lf['redirect'].value = sf['redirect'].value = i.redirect
         sf.fill(i)
         return render.login(lf, sf, redirect=i.redirect)
     user = new_user(i.email, i.password)
     helpers.set_login_cookie(i.email)
     raise web.seeother(i.redirect, absolute=True)
Пример #8
0
 def POST(self):
     i = web.input(redirect='/')
     lf = forms.loginform()
     if not lf.validates(i):
         sf = forms.signupform()
         lf['redirect'].value = sf['redirect'].value = i.redirect
         lf.fill(i)
         return render.login(lf, sf, redirect=i.redirect)
     else:
         state = i.get('state')
         if state:
             state = json.loads(state)
             return internal_redirect(state['redirect'], state['method'], state['query'], state['data'])
         else:    
             raise web.seeother(i.redirect, absolute=True)
Пример #9
0
 def POST(self):
     i = web.input(redirect='/')
     lf = forms.loginform()
     if not lf.validates(i):
         sf = forms.signupform()
         lf['redirect'].value = sf['redirect'].value = i.redirect
         lf.fill(i)
         return render.login(lf, sf, redirect=i.redirect)
     else:
         state = i.get('state')
         if state:
             state = json.loads(state)
             return internal_redirect(state['redirect'], state['method'],
                                      state['query'], state['data'])
         else:
             raise web.seeother(i.redirect, absolute=True)
Пример #10
0
def do_login(email, state):
    lf, sf = forms.loginform(), forms.signupform()
    lf.fill(useremail=email, redirect=state['redirect'], state=json.dumps(state))
    sf.fill(redirect=state['redirect'], state=state)
    return render.login(lf, sf)