Skip to content

Instantly share code, notes, and snippets.

@ctataryn
Created January 29, 2015 15:15
Show Gist options
  • Save ctataryn/ff48723aca03644fab86 to your computer and use it in GitHub Desktop.
Save ctataryn/ff48723aca03644fab86 to your computer and use it in GitHub Desktop.
$.ajaxSetup({
statusCode : {
//403 should mean they don't have a session, however if we
//throw 403s for more granular pressision checks, we'll want
//to do some further checking here to see if the session is
//indeed invalid before showing the session expiry dialog
//and bouncing them to the landing page
403: function() {
var route = container.lookup('route:application');
var sessionController = container.lookup('controller:session');
var modalController = container.lookup('controller:message-modal');
modalController.set('onClose', function() {
//we know their session has expired, so update the UI
sessionController.send('loggedOut');
});
route.render('message-modal', {
into: 'application',
outlet: 'modal',
model: {
title: Ember.I18n.t('sessionTimeout.title'),
message: Ember.I18n.t('sessionTimeout')
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment