MTrackWeb/templates/images/js/mtrack2.login.js
authorAlan Knowles <alan@akkbhome.com>
Sat, 4 Jun 2011 08:46:43 +0000 (16:46 +0800)
committerAlan Knowles <alan@akkbhome.com>
Sat, 4 Jun 2011 08:46:43 +0000 (16:46 +0800)
MTrackWeb/templates/images/js/mtrack2.login.js

index 7c5159d..1293958 100644 (file)
@@ -5,33 +5,34 @@ MTrack.register('.login-form', 'on', 'submit', function( event)
     event.preventDefault();
  
     Roo.Ajax.request({
-            url : baseURL + '/Login.php',
-            type : 'POST',
-            params:  Roo.lib.Ajax.serializeForm(Roo.select('.login-form').first().dom),
-            success : function(res) {
-                var data = false;
-                try { 
-                    data = Roo.decode(res.responseText);
-                } catch(e) {
-                    Roo.MessageBox.alert("Error sending : " + res.responseText);
-                    return;
-                }
-                
-                if (data.success) {
-                    // we could be clever and use the history here..
-                    document.location = baseURL;
-                     return;
-                }
-                // aghh.. mixing content/data...
-                var emap = {
-                    'bad_1' : "The username and password does not match our records (1)",
-                    'bad_2' : "The username and password does not match our records (2)",
-                   'bad_3' : "The username and password does not match our records (3)",
-                   'disabled' : "This account has been disabled"
-                  };
-                Roo.MessageBox.alert("Error",  
-                  (typeof(emap[data.message]) == 'undefined' ? data.message : emap[data.message])  
-                );
+        url : baseURL + '/Login.php',
+        type : 'POST',
+        params:  Roo.lib.Ajax.serializeForm(Roo.select('.login-form').first().dom),
+        success : function(res) {
+            var data = false;
+            try { 
+                data = Roo.decode(res.responseText);
+            } catch(e) {
+                Roo.MessageBox.alert("Error sending : " + res.responseText);
+                return;
             }
+            
+            if (data.success) {
+                // we could be clever and use the history here..
+                document.location = baseURL + '/Browse?ts=' + Math.random();
+                 return;
+            }
+            // aghh.. mixing content/data...
+            var emap = {
+                'bad_1' : "The username and password does not match our records (1)",
+                'bad_2' : "The username and password does not match our records (2)",
+               'bad_3' : "The username and password does not match our records (3)",
+               'disabled' : "This account has been disabled"
+              };
+            Roo.MessageBox.alert("Error",  
+              (typeof(emap[data.message]) == 'undefined' ? data.message : emap[data.message])  
+            );
+        }
+        
     });
 });
\ No newline at end of file