Commit 5831c1c0 authored by Benjamin Fischer's avatar Benjamin Fischer

Workspace: fixed auto_connect handling

parent caf19fd5
......@@ -38,6 +38,8 @@ class AjaxController(AbstractController):
cherrypy.session["user_id"] = user.id
cherrypy.session["user_name"] = user.name
self.autoconnectworkspace(user, password)
return { "userId": user.id, "sessionId": cherrypy.session.id }
@cherrypy.expose
......@@ -78,6 +80,7 @@ class AjaxController(AbstractController):
if user.active():
cherrypy.session["user_id"] = unicode(user.id)
cherrypy.session["user_name"] = user.name
self.autoconnectworkspace(user, password)
# json
@cherrypy.expose
......@@ -187,6 +190,13 @@ class AjaxController(AbstractController):
vispa.workspace.connect(workspace, user, db, password)
def autoconnectworkspace(self, user, password):
db = cherrypy.request.db
for ws in Workspace.get_user_workspaces(db, user):
if ws.auto_connect:
vispa.workspace.connect(ws, user, db, password)
@cherrypy.expose
@cherrypy.tools.method(accept="POST")
def disconnectworkspace(self, wid):
......
......@@ -69,9 +69,6 @@ define([
$("#login-alert").fadeIn(100).render({alert: err.message});
$("#login-name").focus();
} else {
var d = new Date();
d.setTime(d.getTime() + 60e3);
$.cookie("tmpPass", pass, { expires: d });
window.location.href = self.dynamicURL(location.search);
}
});
......
......@@ -72,11 +72,6 @@ define([
},
});
} else {
var d = new Date();
d.setTime(d.getTime() + 30e3);
$.cookie("tmpPass", pass1, {
expires: d
});
window.location.href = self.dynamicURL("/");
}
});
......
......@@ -68,8 +68,19 @@ define([
id : this.id,
};
Vue.set(this._class._members._vueData.workspaces, this.id, this._vueData);
this._setState(config.connection_status || "disconnected");
this.on("stateChanged", function() {
if (this._passwordDialog) {
this._passwordDialog.abort();
}
if (this.state === "connected") {
var m = this._class._members;
if (m.current === null)
m.current = this.id;
}
});
this._setState(config.connection_status || "disconnected");
// create listeners
var connectWithPass = function(type) {
this.emit("disconnected");
......@@ -90,12 +101,6 @@ define([
this.on("password_required", connectWithPass.bind(this, "password"));
this.on("passphrase_required", connectWithPass.bind(this, "SSH key passphrase"));
this.on("stateChanged", function() {
if (this._passwordDialog) {
this._passwordDialog.abort();
}
});
this.on("connecting", function() {
this._setState("connecting");
});
......@@ -103,9 +108,6 @@ define([
this.on("connected", function() {
this._setState("connected");
this._finishConnect(null);
var m = this._class._members;
if (m.current === null)
m.current = this.id;
});
this.on("disconnecting", function() {
......@@ -239,8 +241,7 @@ define([
}
if (this._state == "disconnected" && !this._passwordDialog) {
this._connect(password || $.cookie("tmpPass") || null);
$.removeCookie("tmpPass");
this._connect(password || null);
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment