Mercurial > lada > lada-client
comparison app/override/RestProxy.js @ 917:2bf35377414a
Use rest response handler to act on unauthenticated request.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 14 Aug 2015 09:31:46 +0200 |
parents | 44d7822d0d55 |
children | f220ba587c89 |
comparison
equal
deleted
inserted
replaced
916:323f02e6e514 | 917:2bf35377414a |
---|---|
11 /* | 11 /* |
12 buildRequest: function (operation) { | 12 buildRequest: function (operation) { |
13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams }; | 13 this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams }; |
14 return this.callParent(arguments); | 14 return this.callParent(arguments); |
15 }, | 15 }, |
16 | 16 */ |
17 processResponse: function (success, operation, request, response, callback, scope) { | 17 processResponse: function (success, operation, request, response, callback, scope) { |
18 /* Check if we were authenticated at one point (Lada.openIDParams) and | 18 /* Check if we were authenticated at one point (Lada.openIDParams) and |
19 * if the response means that we lost that authentcation | 19 * if the response means that we lost that authentcation */ |
20 if (Lada.openIDParams && !success && response.status == 401) { | 20 if (!success && response.status == 401) { |
21 var json = Ext.decode(response.responseText); | 21 var json = Ext.decode(response.responseText); |
22 if (json) { | 22 if (json) { |
23 if (json.message === "699" || json.message === "698") { | 23 if (json.message === "699" || json.message === "698") { |
24 /* This is the unauthorized message with the authentication | 24 /* This is the unauthorized message with the authentication |
25 * redirect in the data | 25 * redirect in the data */ |
26 | 26 |
27 /* We decided to handle this with a redirect to the identity | 27 /* We decided to handle this with a redirect to the identity |
28 * provider. In which case we have no other option then to | 28 * provider. In which case we have no other option then to |
29 * handle it here with relaunch. | 29 * handle it here with relaunch. */ |
30 Ext.MessageBox.confirm('Erneutes Login erforderlich', | 30 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
31 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+ | 31 'Ihre Session ist abgelaufen.<br/>'+ |
32 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + | 32 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + |
33 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + | 33 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
34 'Soll die Anwendung jetzt neu geladen werden?', this.reload); | 34 'Soll die Anwendung jetzt neu geladen werden?', this.reload); |
35 } | 35 } |
36 } | 36 } |
37 } | 37 } |
38 this.callParent(arguments); | 38 this.callParent(arguments); |
39 }, | 39 }, |
40 */ | 40 |
41 reload: function(btn) { | 41 reload: function(btn) { |
42 if (btn === 'yes') { | 42 if (btn === 'yes') { |
43 location.reload(); | 43 location.reload(); |
44 } | 44 } |
45 } | 45 } |