Ensure settings routes redirect to /signin when not authenticated

closes #5412
- call this._super() in beforeModel hooks so that simple-auth can handle the transition before we hit any protected API endpoints
This commit is contained in:
Kevin Ansfield 2015-06-17 00:24:01 +01:00
parent 3061247a7e
commit 42b25a00e3
6 changed files with 13 additions and 6 deletions

View File

@ -10,7 +10,9 @@ export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
config: Ember.inject.service(),
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
if (!this.get('config.apps')) {
return this.transitionTo('settings.general');
}

View File

@ -7,7 +7,8 @@ export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
classNames: ['settings-view-general'],
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor())
.then(this.transitionEditor());

View File

@ -7,7 +7,8 @@ export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
classNames: ['settings'],
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor())
.then(this.transitionEditor());

View File

@ -7,7 +7,8 @@ var NavigationRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings,
classNames: ['settings-view-navigation'],
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor());
},

View File

@ -14,7 +14,8 @@ paginationSettings = {
TagsRoute = AuthenticatedRoute.extend(CurrentUserSettings, PaginationRouteMixin, {
titleToken: 'Settings - Tags',
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor());
},

View File

@ -22,7 +22,8 @@ UsersIndexRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, Pagi
this.setupPagination(paginationSettings);
},
beforeModel: function () {
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor());
},