##// END OF EJS Templates
invalidate the repo list also for online changes. Small fixes in LoginRequired decorator....
invalidate the repo list also for online changes. Small fixes in LoginRequired decorator. Cleaned hgwebdir config.

File last commit:

r186:556473ba default
r194:3d1dd138 default
Show More
login.py
37 lines | 1.2 KiB | text/x-python | PythonLexer
import logging
from formencode import htmlfill
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from pylons_app.lib.base import BaseController, render
import formencode
from pylons_app.model.forms import LoginForm
from pylons_app.lib.auth import AuthUser
log = logging.getLogger(__name__)
class LoginController(BaseController):
def index(self):
if session.get('hg_app_user', AuthUser()).is_authenticated:
return redirect(url('hg_home'))
if request.POST:
#import Login Form validator class
login_form = LoginForm()
try:
c.form_result = login_form.to_python(dict(request.POST))
return redirect(url('hg_home'))
except formencode.Invalid as errors:
c.form_errors = errors.error_dict
return htmlfill.render(
render('/login.html'),
defaults=errors.value,
encoding="UTF-8")
return render('/login.html')
def logout(self):
session['hg_app_user'] = AuthUser()
session.save()
redirect(url('hg_home'))