Many changes for templates
This commit is contained in:
+10
-2
@@ -1,4 +1,4 @@
|
||||
|
||||
# -*- coding: utf8 -*-
|
||||
from pyramid.view import view_config
|
||||
from pyramid.security import remember, forget
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
@@ -9,6 +9,10 @@ import datetime
|
||||
def login(request):
|
||||
return {}
|
||||
|
||||
@view_config(route_name='auth', match_param="action=forgot", renderer="jm2l:templates/login.mako")
|
||||
def forgot(request):
|
||||
return {'forgot':True}
|
||||
|
||||
@view_config(route_name='bymail', renderer="string")
|
||||
def bymail(request):
|
||||
myhash = request.matchdict.get('hash', "")
|
||||
@@ -30,7 +34,7 @@ def bymail(request):
|
||||
def sign_in_out(request):
|
||||
username = request.POST.get('username')
|
||||
if username:
|
||||
user = User.by_name(username)
|
||||
user = User.by_slug(username)
|
||||
if user and user.verify_password(request.POST.get('password')):
|
||||
user.last_logged=datetime.datetime.now()
|
||||
DBSession.merge(user)
|
||||
@@ -41,6 +45,10 @@ def sign_in_out(request):
|
||||
headers = forget(request)
|
||||
else:
|
||||
headers = forget(request)
|
||||
if request.matchdict.get('action')=='in':
|
||||
request.session.flash(('error',u'Vous avez entré un mauvais couple identifiant/password !'))
|
||||
return HTTPFound(location="/sign/login",
|
||||
headers=headers)
|
||||
return HTTPFound(location=request.route_url('home'),
|
||||
headers=headers)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user