diff options
| author | Rucha (Open ERP) <rpa@tinyerp.com> | 2012-08-13 10:44:11 +0530 |
|---|---|---|
| committer | Rucha (Open ERP) <rpa@tinyerp.com> | 2012-08-13 10:44:11 +0530 |
| commit | dd7a2972d8099fdc8ccb17ee6b7a56a4be2bbb1f (patch) | |
| tree | 255b0bb9cba8bd5ecd542db5ed3fdc79a004cba0 /addons/auth_anonymous/static/src/js | |
| parent | 7739d0d69b856c3eca8282e52100a06fe6ab2ff3 (diff) | |
| parent | 9211174a6fbbec8d2637c7d9295714c1657dd8ee (diff) | |
[MERGE]: Merge with latest trunk-addons
bzr revid: rpa@tinyerp.com-20120813051411-5no0xcudwbkw07c5
Diffstat (limited to 'addons/auth_anonymous/static/src/js')
| -rw-r--r-- | addons/auth_anonymous/static/src/js/auth_anonymous.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/addons/auth_anonymous/static/src/js/auth_anonymous.js b/addons/auth_anonymous/static/src/js/auth_anonymous.js new file mode 100644 index 00000000000..fab2be1fd53 --- /dev/null +++ b/addons/auth_anonymous/static/src/js/auth_anonymous.js @@ -0,0 +1,47 @@ +openerp.auth_anonymous = function(instance) { + + instance.web.Login.include({ + start: function() { + var self = this; + return $.when(this._super()).pipe(function() { + var dblist = self._db_list || []; + if (!self.session.session_is_valid() && dblist.length === 1) { + self.remember_credentials = false; + // XXX get login/pass from server (via a rpc call) ? + return self.do_login(dblist[0], 'anonymous', 'anonymous') + } + + }); + }, + }); + + instance.web.UserMenu.include({ + init: function(parent) { + this._super(parent); + if (this.session.username == 'anonymous') { + this.template = 'UserMenu.auth_anonymous'; + this.do_update = function() {}; // avoid change of avatar + } + }, + start: function() { + var self = this; + this._super.apply(this, arguments); + this.$element.find('.oe_topbar_anonymous_login').click(function() { + var p = self.getParent(); + var am = p.action_manager; + p.$element.find('.oe_leftbar').hide(); + am.do_action({ + type:'ir.actions.client', + tag:'login', + target: 'new', + params: { + login_successful: function() { + am.do_action("reload"); + } + } + }); + }); + } + }); + +}; |
