[Mpuls-commits] r4038 - base/trunk/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Oct 27 09:56:12 CEST 2010
Author: torsten
Date: 2010-10-27 09:56:12 +0200 (Wed, 27 Oct 2010)
New Revision: 4038
Modified:
base/trunk/mpulsweb/controllers/auth.py
Log:
* mpulsweb/controllers/auth.py (AuthController.loginAction): Moved
logic to set and save the dbnam from the dblist into a session into
the login-controller.
Modified: base/trunk/mpulsweb/controllers/auth.py
===================================================================
--- base/trunk/mpulsweb/controllers/auth.py 2010-10-27 07:26:21 UTC (rev 4037)
+++ base/trunk/mpulsweb/controllers/auth.py 2010-10-27 07:56:12 UTC (rev 4038)
@@ -1,7 +1,7 @@
import logging
import md5
-from pylons import request, response, tmpl_context as c
+from pylons import request, response, tmpl_context as c, h
from pylons.controllers.util import redirect_to
from mpulsweb.lib.base import BaseController, render, session, auth_cookie_name
@@ -29,6 +29,18 @@
try:
login = request.params.getone('username')
passwd = request.params.getone('password')
+
+ # Try to get the name of the db to connect to from the request
+ # params and check if it is contained in the list of defined
+ # databases.
+ dbname = request.params.get('dbname')
+ if dbname:
+ dblist = h.get_db_selectionlist()
+ if dblist.has_key(dbname):
+ session['DB_NAME_FROM_LIST'] = dbname
+ session.save()
+
+ # Check login
user = checkLogin(login, passwd)
if user:
c.login_failed = False
@@ -45,6 +57,9 @@
redirect_to("/")
else:
c.login_failed = True
+ session.delete()
+ session.save()
+ session.invalidate()
return self.login()
except KeyError:
log.error('Error while fetching username and password')
More information about the Mpuls-commits
mailing list