Commit a2d06c0b authored by Bas Lijnse's avatar Bas Lijnse

Updated client to use session service instead of auth/deauth handlers.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1096 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 7ffa7610
......@@ -74,11 +74,11 @@ itasks.Application = function () {
/**
* Loads and builds the GUI
*/
loadUserInterface: function(displayName, session) {
loadUserInterface: function(session) {
//Update global state
this.session = session;
this.displayName = displayName;
this.session = session.sessionId;
this.displayName = itasks.util.formatUser(session.user);
this.scrollbarWidth = itasks.util.getScrollerWidth();
//Remove the login window
......
......@@ -137,9 +137,7 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
logout: function() {
//Send logout request to the server
Ext.Ajax.request({
url: itasks.config.serverUrl + "/deauthenticate",
method: "POST",
params: {session: itasks.app.session},
url: "/services/json/sessions/" + itasks.app.session + "/delete",
scripts: false,
callback: function () {
//On return, restart the app
......
......@@ -22,7 +22,7 @@ itasks.LoginWindow = Ext.extend(Ext.Window, {
//Fade out the window
this.getEl().fadeOut({
callback: function() {
this.continuation(action.result.displayName, action.result.sessionId);
this.continuation(action.result.session);
},
scope: this
});
......@@ -52,7 +52,7 @@ itasks.LoginWindow = Ext.extend(Ext.Window, {
shadow: false,
items: {
xtype: 'form',
url: itasks.config.serverUrl + '/authenticate',
url: '/services/json/sessions/create',
baseCls: 'x-plain',
style: 'padding: 5px',
layout: 'absolute',
......@@ -126,7 +126,7 @@ itasks.LoginWindow = Ext.extend(Ext.Window, {
setError: function(msg) {
this.getComponent(0).getComponent(1).setText(msg ? msg : "");
},
continuation: function(displayName, sessionId) {
continuation: function(session) {
}
});
......@@ -41,6 +41,17 @@ itasks.util.coloredLabel = function (color, msg) {
return "<span style=\"color: " + color + "; font-weight: bold;\">" + msg + "</span>";
};
itasks.util.formatUser = function (user) {
if (user == "RootUser")
return "Root user"
if (user.length == 2 && user[0] == "RegisteredUser")
return user[1].displayName;
if (user.length == 2 && user[0] == "NamedUser")
return user[1];
return "Unknown user type"
}
itasks.util.fieldLabel = function(optional, label) {
if(optional) {
return label
......
......@@ -15,7 +15,7 @@ import Http, HttpUtil
from HttpServer import :: HTTPServerControl(..), :: HTTPServerOption(..)
import Setup
import AuthenticationHandler, DeauthenticationHandler
//import AuthenticationHandler, DeauthenticationHandler
import NewListHandler, NewStartHandler, WorkListHandler, WorkTabHandler, PropertyHandler, UserListHandler
import TaskTreeForestHandler, ProcessTableHandler
import RPCHandlers
......@@ -42,8 +42,8 @@ where
= [ // 'new' services
(startsWith "/services", serviceDispatch config flows)
//'old' handlers
,((==) (config.serverPath +++ "/authenticate"), handleAnonRequest config flows handleAuthenticationRequest)
,((==) (config.serverPath +++ "/deauthenticate"), handleSessionRequest config flows handleDeauthenticationRequest)
//,((==) (config.serverPath +++ "/authenticate"), handleAnonRequest config flows handleAuthenticationRequest)
//,((==) (config.serverPath +++ "/deauthenticate"), handleSessionRequest config flows handleDeauthenticationRequest)
,((==) (config.serverPath +++ "/new/list"), handleSessionRequest config flows handleNewListRequest)
,((==) (config.serverPath +++ "/new/start"), handleSessionRequest config flows handleNewStartRequest)
,((==) (config.serverPath +++ "/work/list"), handleSessionRequest config flows handleWorkListRequest)
......
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