Revision 870b9bb7
Suppression des url() dans les méthodes login, post_login & post_logout de toutes les applications !TurboGears
pour contourner un bug : http://trac.turbogears.org/ticket/2471 & http://vigilo-dev.si.c-s.fr/trac/ticket/40
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@2221 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/controllers/vigiboard_controller.py | ||
---|---|---|
4 | 4 |
Controller for authentification |
5 | 5 |
""" |
6 | 6 |
|
7 |
from tg import expose, flash, url, request, redirect
|
|
7 |
from tg import expose, flash, request, redirect |
|
8 | 8 |
|
9 | 9 |
from pylons.i18n import ugettext as _ |
10 | 10 |
|
... | ... | |
31 | 31 |
error = ErrorController() |
32 | 32 |
|
33 | 33 |
@expose('login.html') |
34 |
def login(self, came_from=url('/')):
|
|
34 |
def login(self, came_from='/'):
|
|
35 | 35 |
"""Start the user login.""" |
36 | 36 |
login_counter = request.environ['repoze.who.logins'] |
37 | 37 |
if login_counter > 0: |
... | ... | |
40 | 40 |
came_from=came_from) |
41 | 41 |
|
42 | 42 |
@expose() |
43 |
def post_login(self, came_from=url('/')):
|
|
43 |
def post_login(self, came_from='/'):
|
|
44 | 44 |
""" |
45 | 45 |
Redirect the user to the initially requested page on successful |
46 | 46 |
authentication or redirect her back to the login page if login failed. |
47 | 47 |
""" |
48 | 48 |
if not request.identity: |
49 | 49 |
login_counter = request.environ['repoze.who.logins'] + 1 |
50 |
redirect(url('/login', came_from=came_from, __logins=login_counter))
|
|
50 |
redirect('/login', came_from=came_from, __logins=login_counter)
|
|
51 | 51 |
userid = request.identity['repoze.who.userid'] |
52 | 52 |
ApplicationLog.add_login(userid, request.remote_addr, u'Vigiboard') |
53 | 53 |
flash(_('Welcome back, %s!') % userid) |
54 | 54 |
redirect(came_from) |
55 | 55 |
|
56 | 56 |
@expose() |
57 |
def post_logout(self, came_from=url('/')):
|
|
57 |
def post_logout(self, came_from='/'):
|
|
58 | 58 |
""" |
59 | 59 |
Redirect the user to the initially requested page on logout and say |
60 | 60 |
goodbye as well. |
Also available in: Unified diff