diff options
| author | vta vta@openerp.com <> | 2012-08-12 17:07:39 +0200 |
|---|---|---|
| committer | vta vta@openerp.com <> | 2012-08-12 17:07:39 +0200 |
| commit | d0ff62372965ce74984e5b0c1f5a416e1bd580bf (patch) | |
| tree | 72357630c315ea89afa64108a31b8cb102ca8da3 /addons/auth_oauth/static/src | |
| parent | bda8bff7686628fe1a1002cc78fc68294bcdfea1 (diff) | |
[ADD] Basic functionality.
bzr revid: vta@openerp.com-20120812150739-nrdwvxmnnnw8yr54
Diffstat (limited to 'addons/auth_oauth/static/src')
| -rw-r--r-- | addons/auth_oauth/static/src/js/auth_oauth.js | 59 | ||||
| -rw-r--r-- | addons/auth_oauth/static/src/xml/auth_oauth.xml | 3 |
2 files changed, 53 insertions, 9 deletions
diff --git a/addons/auth_oauth/static/src/js/auth_oauth.js b/addons/auth_oauth/static/src/js/auth_oauth.js index fddd4c78ae9..a49d6777e7d 100644 --- a/addons/auth_oauth/static/src/js/auth_oauth.js +++ b/addons/auth_oauth/static/src/js/auth_oauth.js @@ -3,16 +3,61 @@ openerp.auth_oauth = function(instance) { var QWeb = instance.web.qweb; instance.web.Login = instance.web.Login.extend({ - start: function() { - console.log("Tu puta madre!"); + start: function(parent, params) { this._super.apply(this, arguments); + var self = this; + self.$element.on('click', '.oe_login_oauth a', this.on_google_oauth); }, - on_submit: function(ev) { + on_google_oauth: function(ev) { + var url = this._oauth_url(); + window.location = url; }, - do_warn: function(title, msg) { + _oauth_url: function() { + var endpoint = 'https://accounts.google.com/o/oauth2/auth'; + var params = { + response_type: 'token', + client_id: '108010644258-duuhmp6pu7li4tsmnqg7j9rvdeklg0ki.apps.googleusercontent.com', + redirect_uri: 'https://localhost/', + scope: 'https://www.googleapis.com/auth/userinfo.email', + state: 'TEST', + }; + var url = endpoint + '?' + $.param(params); + return url; }, - reset_error_message: function() { - } + // do_warn: function(title, msg) { + // }, + // reset_error_message: function() { + // } }); -};
\ No newline at end of file + instance.web.WebClient = instance.web.WebClient.extend({ + start: function() { + this._super.apply(this, arguments); + // console.log($.deparam(window.location.hash)); + var params = $.deparam(window.location.hash); + if (params.hasOwnProperty('access_token')) { + console.log(params); + // Do login using Google User credentials + var url = { + + }; + } + }, + bind_hashchange: function() { + var state = $.bbq.getState(true); + if (state.hasOwnProperty("access_token")) { + state.action = "login"; + $.bbq.setState(state); + } + this._super(); + + }, + // on_hashchange: function(event) { + // console.log(event); + // this._super.apply(this, arguments); + // }, + }); + +}; + +// https://accounts.google.com/o/oauth2/auth?state=%2Fprofile&redirect_uri=http%3A%2F%2Foauth2-login-demo.appspot.com%2Fcode&response_type=code&client_id=812741506391.apps.googleusercontent.com&approval_prompt=force&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
\ No newline at end of file diff --git a/addons/auth_oauth/static/src/xml/auth_oauth.xml b/addons/auth_oauth/static/src/xml/auth_oauth.xml index 01cf51da9a2..75f168d6c9a 100644 --- a/addons/auth_oauth/static/src/xml/auth_oauth.xml +++ b/addons/auth_oauth/static/src/xml/auth_oauth.xml @@ -5,8 +5,7 @@ <t t-jquery=".oe_login_pane form ul" t-operation="after"> <ul class="oe_login_oauth"> <li>OR</li> - <li>Login with Google</li> - <li>Me cago en tu puta madre</li> + <li><a href="#">Login with Google</a></li> </ul> </t> </t> |
