What is the best way to ensure that user is logged in into the Ember application?
I would like to intercept any URL before the routing is excited, show a modal popup with user_id/password, and go to the original URL.
Perhaps something similar to Rail's application_controller#before_filter which gets executed before any other controller methods.
I have the following routing:
App.Router.map(function(){
this.resource('folder', {path: '/'}, function(){
this.resource('files', {path: '/:folder_id'}, function(){
this.route('index');
});
});
});
I am trying to setup ApplicationRoute:
App.ApplicationRoute = Ember.Route.extend({
activate: function(){
console.log("activating app route");
}
});
But the problem is, if I hit index.html#/folder01, folder route is executed before the application route.
Summarizing the workflow ideally should look like:
- User hits
index.html#/folder01URL - App checks whether user logged in. If not modal popup appears
- After login, the app should render
index.html#/folder01URL
Thanks a lot!