Sfoglia il codice sorgente

fixed annoying cookie bug, user is now logged out if prefences not found

Simon Van Mierlo 9 anni fa
parent
commit
9f92a74cea
4 ha cambiato i file con 15 aggiunte e 5 eliminazioni
  1. 1 0
      client/atompm.html
  2. 1 1
      client/client.js
  3. 2 2
      client/user_management.js
  4. 11 2
      httpwsd.js

+ 1 - 0
client/atompm.html

@@ -57,6 +57,7 @@ with AToMPM.  If not, see <http://www.gnu.org/licenses/>.
 		<script text="text/javascript" src="client/collaboration.js"></script>
 		<script text="text/javascript" src="client/client.js"></script>
 		<script text="text/javascript" src="styleinfo.js"></script>
+        <link rel="icon" href="favicon.png">
 		<script>
 			$(document).ready(function(){
 				/**

+ 1 - 1
client/client.js

@@ -220,7 +220,7 @@ function _getUserPreferences(callback,subset)
 			console.debug(statusCode);
 			console.debug(resp);
 			if( ! utils.isHttpSuccessCode(statusCode) )
-				WindowManagement.openDialog(_ERROR, 'failed to retrieve user preferences :: '+resp);
+                UserManagement.logout();
 			else
 				callback(utils.jsonp(resp));
 		});

+ 2 - 2
client/user_management.js

@@ -55,7 +55,7 @@ UserManagement = function(){
 			window.location = window.location.href;
 		}
 	
-		if( __prefs['confirm-exit']['value'] && ! __isSaved() )
+		if( __prefs && __prefs['confirm-exit']['value'] && ! __isSaved() )
 			WindowManagement.openDialog(_CUSTOM, {'widgets':[], 'title':__EXITWARNING}, innerLogout);
 		else
 			innerLogout();
@@ -101,7 +101,7 @@ UserManagement = function(){
 			function(statusCode,resp)
 			{
 				if( ! utils.isHttpSuccessCode(statusCode) )
-					$('#div_login_error').html('login failed :: '+resp);
+					$('#div_login_error').html('login failed, user ' + username + ' not found or network error');
 				else if( resp != Sha1.hash(password) )
 					$('#div_login_error').html('incorrect password');
 				else			

+ 11 - 2
httpwsd.js

@@ -102,6 +102,16 @@ var httpserver = _http.createServer(
 						else
 							__respond(resp,200,'',data,{'Content-Type': 'text/html'});
 					});
+                    
+			else if( req.method == 'GET' && url.pathname == '/favicon.png' )
+				_fs.readFile('./favicon.png', 'binary',
+					function(err, data)
+					{
+						if(err) 
+							__respond(resp,500,String(err));
+						else
+							__respond(resp,200,'',data,{'Content-Type': 'image/png'});
+					});
 
 
 
@@ -651,5 +661,4 @@ wsserver.sockets.on('connection',
 							return;
 						}
 			});
-		});
-
+		});