summaryrefslogtreecommitdiff
path: root/addons/auth_oauth/static/src/js/auth_oauth.js
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2012-08-16 00:47:08 +0200
committerAntony Lesuisse <al@openerp.com>2012-08-16 00:47:08 +0200
commit23178302c4c44034e0bf6b6b1ea1a60d42e7d41c (patch)
tree83317334646cb394af01b2b6783719d02da3a9e0 /addons/auth_oauth/static/src/js/auth_oauth.js
parent35e620ce688d07fd7ff6b0f50510c2c9301d2c7a (diff)
oauth generic with buttons from zocial
bzr revid: al@openerp.com-20120815224708-rcge3914klkwrw6u
Diffstat (limited to 'addons/auth_oauth/static/src/js/auth_oauth.js')
-rw-r--r--addons/auth_oauth/static/src/js/auth_oauth.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/auth_oauth/static/src/js/auth_oauth.js b/addons/auth_oauth/static/src/js/auth_oauth.js
index 67b446a4580..eae423fae1f 100644
--- a/addons/auth_oauth/static/src/js/auth_oauth.js
+++ b/addons/auth_oauth/static/src/js/auth_oauth.js
@@ -4,7 +4,7 @@ openerp.auth_oauth = function(instance) {
instance.web.Login = instance.web.Login.extend({
start: function(parent, params) {
var d = this._super.apply(this, arguments);
- this.$element.on('click', 'a.oe_oauth_sign_in', this.on_oauth_sign_in);
+ this.$element.on('click', 'a.zocial', this.on_oauth_sign_in);
this.oauth_providers = [];
if(this.params.oauth_error === 1) {
this.do_warn("Sign up error.","Sign up is not allowed on this database.");
@@ -26,20 +26,23 @@ openerp.auth_oauth = function(instance) {
console.log(buttons);
this.$(".oe_login_pane form ul").after(buttons);
},
- oauth_url: function(state) {
- },
on_oauth_sign_in: function(ev) {
ev.preventDefault();
var index = $(ev.target).data('index');
var p = this.oauth_providers[index];
var ret = location.protocol+"//"+location.host+"/";
var dbname = self.$("form [name=db]").val();
+ var state_object = {
+ d: dbname,
+ p: p.id
+ }
+ var state = JSON.stringify(state_object);
var params = {
response_type: 'token',
client_id: p.client_id,
redirect_uri: ret,
scope: p.scope,
- state: dbname,
+ state: state,
};
var url = p.auth_endpoint + '?' + $.param(params);
window.location = url;