Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Handle both unauthenticated error messages #2696

Merged
merged 3 commits into from
Nov 8, 2021
Merged

Conversation

gregone
Copy link
Contributor

@gregone gregone commented Nov 8, 2021

Fixes: #2695

In summary:

  • the error message on an unauthenticated request changed to Authorization token is not supplied
  • the error handler that would invalidate the session wasn't firing

This PR also adds an auth acceptance test, just cause that's nice to have

Copy link
Contributor

@jgwhite jgwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. One stylistic point, but apart from that :shipit:

ui/app/routes/application.ts Outdated Show resolved Hide resolved
Comment on lines +8 to +22
module('Acceptance | auth', function (hooks: NestedHooks) {
setupApplicationTest(hooks);
setupMirage(hooks);

test('redirects to /auth from authenticated routes when logged out', async function (assert) {
await visit(`/default`);
assert.equal(currentURL(), `/auth`);
});

test('does not redirect to /auth from authenticated routes when logged in', async function (assert) {
await login();
await visit(`/default`);
assert.equal(currentURL(), `/default`);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test!

@gregone gregone merged commit 7df42ab into main Nov 8, 2021
@gregone gregone deleted the ui/simple-auth-fix branch November 8, 2021 16:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui: redirect to /auth when no token is present
2 participants