Skip to content

Commit

Permalink
Handle emails which include underscores, remove duplicate code in map
Browse files Browse the repository at this point in the history
  • Loading branch information
vej-ananas committed Aug 29, 2024
1 parent efdf9ed commit 565fc8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/server-asset-sg/src/core/middleware/jwt.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class JwtMiddleware implements NestMiddleware {
if (!('username' in payload) || payload.username.length === 0) {
throw new HttpException('invalid JWT payload: missing username', 401);
}
const email = payload.username.split('_')[1];
const email = payload.username.split('_').slice(1).join('');
if (email == null || !/^.+@.+\..+$/.test(email)) {
throw new HttpException('invalid JWT payload: username does not contain an email', 401);
}
Expand Down
8 changes: 1 addition & 7 deletions libs/asset-viewer/src/lib/components/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,9 @@ export class MapComponent implements AfterViewInit, OnChanges, OnDestroy {
this.subscription.add(
studies$.subscribe((studies) => {
this.controller.setStudies(studies);
setTimeout(() => this.initializeEnd.emit());
})
);

this.controller.isInitialized$
.pipe(
first(identity),
switchMap(() => studies$)
)
.subscribe(() => this.initializeEnd.emit());
}

private initializeStoreBindings() {
Expand Down

0 comments on commit 565fc8a

Please sign in to comment.