Merge pull request #69 from odoo-dev/saas-4-auth-user-login-redirect-fme
Automatic auth='user' redirection for unlogged users
This commit is contained in:
commit
a78e27fc0c
|
@ -5,8 +5,7 @@ import logging
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import werkzeug.exceptions
|
import werkzeug
|
||||||
import werkzeug.routing
|
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import http
|
from openerp import http
|
||||||
|
@ -59,6 +58,12 @@ class ir_http(osv.AbstractModel):
|
||||||
def _auth_method_user(self):
|
def _auth_method_user(self):
|
||||||
request.uid = request.session.uid
|
request.uid = request.session.uid
|
||||||
if not request.uid:
|
if not request.uid:
|
||||||
|
if not request.params.get('noredirect'):
|
||||||
|
query = werkzeug.url_encode({
|
||||||
|
'redirect': request.httprequest.url,
|
||||||
|
})
|
||||||
|
response = werkzeug.utils.redirect('/web/login?%s' % query)
|
||||||
|
werkzeug.exceptions.abort(response)
|
||||||
raise http.SessionExpiredException("Session expired")
|
raise http.SessionExpiredException("Session expired")
|
||||||
|
|
||||||
def _auth_method_none(self):
|
def _auth_method_none(self):
|
||||||
|
|
Loading…
Reference in New Issue