Skip to content
Open
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
190 changes: 185 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"@ngrx/store": "^20.1.0",
"@ngx-translate/core": "^17.0.0",
"@nicky-lenaers/ngx-scroll-to": "^14.0.0",
"@popperjs/core": "^2.11.8",
"@terraformer/wkt": "^2.2.2",
"altcha": "^2.3.0",
"angulartics2": "^12.2.0",
Expand Down Expand Up @@ -147,6 +148,7 @@
"nouislider": "^15.7.1",
"orejime": "^2.3.3",
"pem": "1.14.8",
"qrcode": "^1.5.4",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.0",
"uuid": "^14.0.1",
Expand Down Expand Up @@ -179,6 +181,7 @@
"@types/js-cookie": "3.0.6",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.19.43",
"@types/qrcode": "^1.5.6",
"@typescript-eslint/eslint-plugin": "^8.62.1",
"@typescript-eslint/parser": "^8.62.1",
"@typescript-eslint/rule-tester": "^8.62.1",
Expand Down
17 changes: 16 additions & 1 deletion src/app/core/auth/auth.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {
} from './auth.actions';
// import services
import { AuthService } from './auth.service';
import { MfaRequiredAction } from './mfa.actions';
import { AuthMethod } from './models/auth.method';
import { AuthStatus } from './models/auth-status.model';
import { AuthTokenInfo } from './models/auth-token-info.model';
Expand Down Expand Up @@ -117,7 +118,21 @@ export class AuthEffects {

public authenticateSuccess$: Observable<Action> = createEffect(() => this.actions$.pipe(
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload)),
map((action: AuthenticationSuccessAction) => {
// Check if the token has mfa_verified=false, meaning MFA verification is needed
const token = action.payload;
if (token && token.accessToken) {
try {
const payload = JSON.parse(atob(token.accessToken.split('.')[1]));
if (payload.mfa_verified === false) {
return new MfaRequiredAction(token);
}
} catch (e) {
// If token parsing fails, proceed with normal flow
}
}
return new AuthenticatedAction(action.payload);
}),
));

public authenticated$: Observable<Action> = createEffect(() => this.actions$.pipe(
Expand Down
Loading
Loading