[FIX] main.py
bzr revid: vta@openerp.com-20120814124636-nhv4iurcc9phe3cm
This commit is contained in:
parent
ebc010fd39
commit
ba5168192a
|
@ -31,11 +31,13 @@ class OAuthController(openerpweb.Controller):
|
||||||
return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials)
|
return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# auth_signup is not installed
|
# auth_signup is not installed
|
||||||
|
_logger.exception("attribute error")
|
||||||
url = "/#action=auth_signup&error=1"
|
url = "/#action=auth_signup&error=1"
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
# signup error
|
# signup error
|
||||||
|
_logger.exception('oops')
|
||||||
url = "/#action=auth_signup&error=2"
|
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:
|
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
import urllib2
|
import urllib2
|
||||||
import simplejson
|
import simplejson
|
||||||
|
|
||||||
|
@ -5,6 +7,8 @@ import openerp
|
||||||
|
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class res_users(osv.Model):
|
class res_users(osv.Model):
|
||||||
|
|
||||||
_inherit = 'res.users'
|
_inherit = 'res.users'
|
||||||
|
@ -46,13 +50,14 @@ class res_users(osv.Model):
|
||||||
|
|
||||||
login = validation['email']
|
login = validation['email']
|
||||||
oauth_uid = validation['user_id']
|
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)
|
r = (cr.dbname, login, access_token)
|
||||||
|
|
||||||
res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)])
|
res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)])
|
||||||
|
_logger.exception(res)
|
||||||
if 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:
|
else:
|
||||||
# New user
|
# New user
|
||||||
new_user = {
|
new_user = {
|
||||||
|
|
Loading…
Reference in New Issue