[FIX] session not sticking on page reload, fix toggle back from database management to login window as well

bzr revid: xmo@openerp.com-20110802081022-30o15ju3bj88xaty
This commit is contained in:
Xavier Morel
2011-08-02 10:10:22 +02:00
parent 338b07614a
commit 093cbdbef9
+21 -9
View File
@@ -708,9 +708,23 @@ openerp.base.Database = openerp.base.Controller.extend({
this.$element.find('#db-restore').click(this.do_db_restore);
this.$element.find('#db-change-password').click(this.do_change_password);
this.$element.find('#back-to-login').click(function() {
window.location.reload();
self.stop();
});
},
stop: function () {
this.$option_id.empty();
this.$element
.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login')
.unbind('click')
.end()
.closest(".openerp")
.addClass("login-mode")
.removeClass("database_block")
.end()
.empty();
},
/**
* Converts a .serializeArray() result into a dict. Does not bother folding
* multiple identical keys into an array, last key wins.
@@ -966,18 +980,16 @@ openerp.base.Login = openerp.base.Controller.extend({
},
display: function() {
var self = this;
this.$element.html(QWeb.render("Login", this));
this.$element.closest(".openerp").removeClass("database_block");
this.$element.closest(".openerp").addClass("login-mode");
this.database = new openerp.base.Database(
this, "oe_database", "oe_db_options");
this.$element.find('#oe-db-config').click(function() {
self.database = new openerp.base.Database(self, "oe_database", "oe_db_options");
self.database.start();
});
this.$element.find("form").submit(this.on_submit);
this.$element.find("form").submit(this.on_submit);
},
on_login_invalid: function() {
this.$element.closest(".openerp").addClass("login-mode");