fix: 🐛 all top level routes should redirect in unauthenticated
This commit is contained in:
6 files changed
+40
-6
No files matched your search
@@ -7,9 +7,17 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all auth-methods under current scope
|
||||
* @return {Promise[AuthMethodModel]}
|
||||
|
||||
@@ -7,9 +7,17 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all groups under current scope
|
||||
* @return {Promise[GroupModel]}
|
||||
|
||||
@@ -8,9 +8,17 @@ export default class ScopesScopeOrgsRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all scopes under the global scope.
|
||||
* @return {Promise{[ScopeModel]}}
|
||||
|
||||
@@ -7,9 +7,17 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all roles under current scope.
|
||||
* @return {Promise{[RoleModel]}}
|
||||
|
||||
@@ -7,9 +7,17 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all users under current scope.
|
||||
* @return {Promise{[UserModel]}}
|
||||
|
||||
@@ -23,12 +23,6 @@ module('Unit | Authenticator | password', function (hooks) {
|
||||
session.invalidate();
|
||||
});
|
||||
|
||||
test('it does not add an authorization header to application adapter on restore if no token is present', async function (assert) {
|
||||
assert.expect(1);
|
||||
authenticator.restore({ token: null });
|
||||
assert.notOk(applicationAdapter?.headers?.Authorization);
|
||||
});
|
||||
|
||||
test('it adds an authorization header to application adapter on restore', async function (assert) {
|
||||
assert.expect(1);
|
||||
authenticator.restore({ token: 'token1234' });
|
||||
|
||||
Reference in new issue
Block a user