comparison app/view/window/GenProbenFromMessprogramm.js @ 920:f220ba587c89

Adopted Client to SSO, detect a Sessiontimeout and reload the application
author Dustin Demuth <dustin@intevation.de>
date Fri, 14 Aug 2015 13:27:50 +0200
parents 8054232535ba
children f73ca04d73a7
comparison
equal deleted inserted replaced
919:c8599a543f03 920:f220ba587c89
56 56
57 57
58 Ext.Ajax.request({ 58 Ext.Ajax.request({
59 url: 'lada-server/probe/messprogramm', 59 url: 'lada-server/probe/messprogramm',
60 method: 'POST', 60 method: 'POST',
61 headers: {
62 'X-OPENID-PARAMS': Lada.openIDParams
63 },
64 jsonData: jsondata, 61 jsonData: jsondata,
65 success: function(response) { 62 success: function(response) {
66 var json = Ext.JSON.decode(response.responseText); 63 var json = Ext.JSON.decode(response.responseText);
67 Ext.Msg.show({ 64 Ext.Msg.show({
68 title: i18n.getMsg('success'), 65 title: i18n.getMsg('success'),
83 } 80 }
84 if (json) { 81 if (json) {
85 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ 82 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
86 formPanel.setMessages(json.errors, json.warnings); 83 formPanel.setMessages(json.errors, json.warnings);
87 } 84 }
88 // TODO Move this handling of 699 and 698 to a more central place! 85 /*
89 // TODO i18n 86 SSO will send a 302 if the Client is not authenticated
90 if (json.message === "699" || json.message === "698") { 87 unfortunately this seems to be filtered by the browser.
91 /* This is the unauthorized message with the authentication 88 We assume that a 302 was send when the follwing statement
92 * redirect in the data */ 89 is true.
93 90 */
94 /* We decided to handle this with a redirect to the identity 91 if (response.status == 0 && response.responseText === "") {
95 * provider. In which case we have no other option then to
96 * handle it here with relaunch. */
97 Ext.MessageBox.confirm('Erneutes Login erforderlich', 92 Ext.MessageBox.confirm('Erneutes Login erforderlich',
98 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+ 93 'Ihre Session ist abgelaufen.<br/>'+
99 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + 94 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
100 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + 95 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
101 'Soll die Anwendung jetzt neu geladen werden?', me.reload); 96 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
102 } 97 }
103 else if(json.message){ 98 // further error handling
99 if(json.message){
104 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') 100 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title')
105 +' #'+json.message, 101 +' #'+json.message,
106 Lada.getApplication().bundle.getMsg(json.message)); 102 Lada.getApplication().bundle.getMsg(json.message));
107 } else { 103 } else {
108 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), 104 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'),

http://lada.wald.intevation.org