diff --git a/addons/anonymous/static/src/js/anonymous.js b/addons/anonymous/static/src/js/anonymous.js index c4dc412dda1..15c03a6ce63 100644 --- a/addons/anonymous/static/src/js/anonymous.js +++ b/addons/anonymous/static/src/js/anonymous.js @@ -1,29 +1,20 @@ openerp.anonymous = function(instance) { - instance.web.client_actions.add("login", "instance.web.Login"); - - instance.web.WebClient.include({ - show_login: function() { - var self = this, _super = this._super; - this.login.load_db_list().then(function() { - var dblist = self.login._db_list; + instance.web.Login.include({ + start: function() { + var self = this; + return $.when(this._super()).pipe(function() { + var dblist = self._db_list; if (dblist && dblist.length === 1) { - self.login.remember_credentials = false; + self.remember_credentials = false; // XXX get login/pass from server (via a rpc call) ? - self.login.do_login(dblist[0], 'anonymous', 'anonymous').fail(function() { - _super.apply(self, []); - }); - } else { - _super.apply(self, []); + return self.do_login(dblist[0], 'anonymous', 'anonymous') } + }); }, - restart: function() { - return this.start(); - } }); - instance.web.UserMenu.include({ init: function(parent) { this._super(parent); @@ -39,8 +30,8 @@ openerp.anonymous = function(instance) { var p = self.getParent(); var am = p.action_manager; p.$element.find('.oe_leftbar').hide(); - am.do_action({type:'ir.actions.client', tag:'login'}); - am.inner_widget.on('login', p, p.restart); + am.do_action({type:'ir.actions.client', tag:'login', target: 'new'}); + am.dialog_widget.on('login', p, p.restart); }); } });