summaryrefslogtreecommitdiff
path: root/addons/auth_oauth/static/src/js/auth_oauth.js
diff options
context:
space:
mode:
authorvta vta@openerp.com <>2012-08-12 17:07:39 +0200
committervta vta@openerp.com <>2012-08-12 17:07:39 +0200
commitd0ff62372965ce74984e5b0c1f5a416e1bd580bf (patch)
tree72357630c315ea89afa64108a31b8cb102ca8da3 /addons/auth_oauth/static/src/js/auth_oauth.js
parentbda8bff7686628fe1a1002cc78fc68294bcdfea1 (diff)
[ADD] Basic functionality.
bzr revid: vta@openerp.com-20120812150739-nrdwvxmnnnw8yr54
Diffstat (limited to 'addons/auth_oauth/static/src/js/auth_oauth.js')
-rw-r--r--addons/auth_oauth/static/src/js/auth_oauth.js59
1 files changed, 52 insertions, 7 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