Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/decorators/check-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export default function checkAuth<T extends ConcreteSubclass<Route>>(
// Need to handle view-only links before checking auth, and this is the only reasonable place to do it.
// This limitation points toward replacing this decorator with a service method meant to be
// called in Route.beforeModel. Decorator mixins should probably be considered an anti-pattern.
const { viewOnlyToken = '' } = this.paramsFor('application') as Record<string, string>;
let { viewOnlyToken = '' } = this.paramsFor('application') as Record<string, string>;

try {
if (!this.session.isAuthenticated || this.currentUser.viewOnlyToken !== viewOnlyToken) {
// This is for ENG-8174 where occasionally a %2F or / is at the end of the viewOnlyToken
viewOnlyToken = viewOnlyToken.replace(/(%2[fF]|\/)$/g, '');
this.currentUser.setProperties({ viewOnlyToken });

// Check whether user is actually logged in.
Expand Down
2 changes: 1 addition & 1 deletion mirage/views/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function fakeCheckCredentials(
async function emulateUserDoingOAuthFlow(authorizedAccount: ModelInstance<AllAuthorizedAccountTypes>, schema: Schema) {
await timeout(1000);
// eslint-disable-next-line no-console
console.log('Mirage addons view: emulateUserDoingOAuthFlow done');
console.info('Mirage addons view: emulateUserDoingOAuthFlow done');
const currentUser = schema.roots.first().currentUser;
authorizedAccount.update({
credentialsAvailable: true,
Expand Down