diff options
| author | Martin Trigaux <mat@odoo.com> | 2015-06-09 12:40:10 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2015-06-09 15:05:57 +0200 |
| commit | 87d48b0859c1cbd6a98fca2dfc97fae0e838055f (patch) | |
| tree | eef167b04537d735aa0b64c6a046f8167374c27b /addons/web/controllers | |
| parent | 4d7671a4c355b33aa75a2aa81d3ea84ce164538f (diff) | |
[FIX] web: do not crash when select wrong db
When a user tries to log into a postgresql database with no view web.login (this
happens if the database is not an odoo database or using a previous version of
odoo), the rendering failed, producing a 500 error (with no detail for the user)
Instead, redirect to the database selector with an informative message.
Fixes #3443
The database selector page is a jinja template with no access to database
required so should be able to be displayed on any database.
Future improvement could verify the version of base module for even more precise
verification before login (but need to make sure it's always accurate).
Diffstat (limited to 'addons/web/controllers')
| -rw-r--r-- | addons/web/controllers/main.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8b3a21fdee8..340b57da5f1 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -511,7 +511,13 @@ class Home(http.Controller): return http.redirect_with_hash(redirect) request.uid = old_uid values['error'] = "Wrong login/password" - return request.render('web.login', values) + if request.env.ref('web.login', False): + return request.render('web.login', values) + else: + # probably not an odoo compatible database + error = 'Unable to login on database %s' % request.session.db + return werkzeug.utils.redirect('/web/database/selector?error=%s' % error, 303) + @http.route('/login', type='http', auth="none") def login(self, db, login, key, redirect="/web", **kw): @@ -664,6 +670,7 @@ class Database(http.Controller): return env.get_template("database_selector.html").render({ 'databases': dbs, 'debug': request.debug, + 'error': kw.get('error') }) @http.route('/web/database/manager', type='http', auth="none") |
