diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index 381602dff46..664d510e65f 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -31,11 +31,13 @@ class OAuthController(openerpweb.Controller): return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials) except AttributeError: # auth_signup is not installed + _logger.exception("attribute error") url = "/#action=auth_signup&error=1" except Exception,e: # signup error + _logger.exception('oops') url = "/#action=auth_signup&error=2" - return werkzeug.utils.redirect("http://localhost:8069") + return openerp.addons.web.controllers.main.set_cookie_and_redirect(req, "/") # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_oauth/res_users.py b/addons/auth_oauth/res_users.py index 98bd020a8c0..4cae3bd4880 100644 --- a/addons/auth_oauth/res_users.py +++ b/addons/auth_oauth/res_users.py @@ -1,3 +1,5 @@ +import logging + import urllib2 import simplejson @@ -5,6 +7,8 @@ import openerp from openerp.osv import osv, fields +_logger = logging.getLogger(__name__) + class res_users(osv.Model): _inherit = 'res.users' @@ -46,13 +50,14 @@ class res_users(osv.Model): login = validation['email'] oauth_uid = validation['user_id'] - name = self.auth_oauth_fetch_user_data(cr, uid, params)['name'] + name = self.auth_oauth_fetch_user_data(cr, uid, access_token)['name'] r = (cr.dbname, login, access_token) - + res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)]) + _logger.exception(res) if res: - self.write(cr, uid, res[0]['id'], {'oauth_access_token':access_token}) + self.write(cr, uid, res[0], {'oauth_access_token':access_token}) else: # New user new_user = {