summaryrefslogtreecommitdiff
path: root/addons/auth_anonymous/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2012-08-02 17:47:49 +0200
committerChristophe Simonis <chs@openerp.com>2012-08-02 17:47:49 +0200
commit2f9da3ba1e08db8e680df3d9e0a1056eb31fab22 (patch)
tree550ebcc55e8027ad3dee0dc78384e35d8eb6794c /addons/auth_anonymous/static/src/js
parent6b23be4a25db4a869d918360c15aadd9e61c66fa (diff)
[IMP] rename module "anonymous" to "auth_anonymous" + recategorize auth modules
bzr revid: chs@openerp.com-20120802154749-rl2240e8fak1457q
Diffstat (limited to 'addons/auth_anonymous/static/src/js')
-rw-r--r--addons/auth_anonymous/static/src/js/auth_anonymous.js47
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");
+ }
+ }
+ });
+ });
+ }
+ });
+
+};