# HG changeset patch # User Andre Heinecke # Date 1426263429 -3600 # Node ID fb89f61ab2727fab03266b69a8cf58204715122b # Parent ab48824713e2d1eba83b57d0d4b45bc934645d48 Improve error handling on authentication loss. diff -r ab48824713e2 -r fb89f61ab272 app/override/RestProxy.js --- a/app/override/RestProxy.js Fri Mar 13 15:00:55 2015 +0100 +++ b/app/override/RestProxy.js Fri Mar 13 17:17:09 2015 +0100 @@ -15,20 +15,31 @@ }, processResponse: function (success, operation, request, response, callback, scope) { - if (!success && response.status == 401) { + /* Check if we were authenticated at one point (Lada.openIDParams) and + * if the response means that we lost that authentcation */ + if (Lada.openIDParams && !success && response.status == 401) { var json = Ext.decode(response.responseText); if (json) { - if (json.message == "699") { + if (json.message === "699" || json.message === "698") { /* This is the unauthorized message with the authentication * redirect in the data */ /* We decided to handle this with a redirect to the identity * provider. In which case we have no other option then to * handle it here with relaunch. */ - Lada.launch(); // Data loss! + Ext.MessageBox.confirm('Erneutes Login erforderlich', + 'Der Server konnte die Anfrage nicht authentifizieren.
'+ + 'Für ein erneutes Login muss die Anwendung neu geladen werden.
' + + 'Alle ungesicherten Daten gehen dabei verloren.
' + + 'Soll die Anwendung jetzt neu geladen werden?', this.reload); } } } this.callParent(arguments); + }, + reload: function(btn) { + if (btn === 'yes') { + location.reload(); + } } });