mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 22:53:32 +03:00
42a1d55858
Ref #2413 - Remove fixture and use actual API - Store and send down actual logged in user data - Refactor isLoggedIn to use computed property on application - After signin, update user data in dependency container - Add CSRF to all routes and controllers via initializer - Update authenticated route to check for user.isLoggedIn - Add notifications for signin error - Add notifications.showAPIError helper - Add plumbing for refreshless signup to doSignUp in admin controller
19 lines
450 B
JavaScript
19 lines
450 B
JavaScript
var AuthenticatedRoute = Ember.Route.extend({
|
|
beforeModel: function () {
|
|
if (!this.get('user.isSignedIn')) {
|
|
this.notifications.showError('Please sign in');
|
|
|
|
this.transitionTo('signin');
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
error: function (error) {
|
|
if (error.jqXHR.status === 401) {
|
|
this.transitionTo('signin');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
export default AuthenticatedRoute; |