def index(self): who_api = get_api(request.environ) user = who_api.authenticate() if not user: return who_api.challenge() # Return a rendered template return render('/index.mako', {'user': user})
def save(self): login = request.POST['login'] password = request.POST['password'] user = Session.query(User).filter_by(login=login, passwd=password).first() if not user: return render('/login.mako', {'error': 'wrong credentials'}) session['logged_user'] = {'login': user.login, 'name': user.name} session.save() redirect(url(controller='home'))
def index(self): return render('/login.mako')