Skip to content

Commit feb9986

Browse files
committed
Fix session messaging.
1 parent d7d0750 commit feb9986

File tree

2 files changed

+40
-28
lines changed

2 files changed

+40
-28
lines changed

webapp/Connector/src/controller/Signin.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Ext.define('Connector.controller.Signin', {
1616
});
1717

1818
/* Flag that is true when an unauthorized request has been handled */
19+
var MSG_KEY = 'SIGNIN';
1920
this.BAD_AUTH = false;
2021
var me = this;
2122

@@ -24,7 +25,7 @@ Ext.define('Connector.controller.Signin', {
2425
me.BAD_AUTH = true;
2526
Ext.Ajax.abortAll();
2627
LABKEY.user.isSignedIn = false;
27-
Connector.getService('Messaging').pushMessage('Your session has timed out. Please login to continue.');
28+
Connector.getService('Messaging').pushMessage(MSG_KEY, 'Your session has timed out. Please login to continue.');
2829
window.location.reload();
2930
return false;
3031
});
@@ -35,6 +36,9 @@ Ext.define('Connector.controller.Signin', {
3536
});
3637

3738
this.callParent();
39+
40+
/* Ensure that we clear out the messaging each time the app loads to avoid showing stale messages */
41+
this._msgs = Connector.getService('Messaging').popMessages(MSG_KEY);
3842
},
3943

4044
createView : function(xtype, context) {
@@ -43,6 +47,7 @@ Ext.define('Connector.controller.Signin', {
4347
switch (xtype) {
4448
case 'signin':
4549

50+
c.msgs = this._msgs;
4651
v = Ext.create('Connector.view.Signin', c);
4752

4853
v.on('userSignedIn', function() { window.location.reload(); });

webapp/Connector/src/view/Signin.js

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Ext.define('Connector.view.SigninForm', {
7979
}),
8080

8181
constructor : function(config) {
82-
this.callParent(config);
82+
this.callParent([config]);
8383
this.addEvents('userSignedIn');
8484
},
8585

@@ -90,14 +90,15 @@ Ext.define('Connector.view.SigninForm', {
9090
email : Ext.util.Cookies.get(this.COOKIE_EMAIL) || ''
9191
};
9292

93-
var msgs = Connector.getService('Messaging').popMessages(), sep = '';
94-
95-
Ext.each(msgs, function(msg) {
96-
if (Ext.isEmpty(this.context.error)) {
97-
this.context.error = '';
98-
}
99-
this.context.error += sep + msg.message; sep = '\n';
100-
}, this);
93+
var hasMsg = !Ext.isEmpty(this.msgs), sep = '';
94+
if (hasMsg) {
95+
Ext.each(this.msgs, function(msg) {
96+
if (Ext.isEmpty(this.context.error)) {
97+
this.context.error = '';
98+
}
99+
this.context.error += sep + msg.message; sep = '\n';
100+
}, this);
101+
}
101102

102103
this.data = this.context;
103104

@@ -202,24 +203,30 @@ Ext.define('Connector.view.Signin', {
202203

203204
ui: 'custom',
204205

205-
items: [{
206-
xtype: 'container',
207-
cls: 'signin-left',
208-
layout: {
209-
type: 'vbox',
210-
align: 'stretch'
211-
},
212-
flex: 1,
213-
items: [{
214-
xtype: 'homeheader'
215-
}, {
216-
xtype: 'about',
217-
cls: 'auto-scroll-y',
218-
flex: 1
219-
}]
220-
}, {
221-
xtype: 'signinform'
222-
}],
206+
initComponent : function() {
207+
208+
this.items = [{
209+
xtype: 'container',
210+
cls: 'signin-left',
211+
layout: {
212+
type: 'vbox',
213+
align: 'stretch'
214+
},
215+
flex: 1,
216+
items: [{
217+
xtype: 'homeheader'
218+
}, {
219+
xtype: 'about',
220+
cls: 'auto-scroll-y',
221+
flex: 1
222+
}]
223+
},{
224+
xtype: 'signinform',
225+
msgs: this.msgs
226+
}];
227+
228+
this.callParent();
229+
},
223230

224231
afterRender : function() {
225232
this.callParent();

0 commit comments

Comments
 (0)