Ignore IP authentication method in login component.

lint fix

using enum

Simplified assignment.
This commit is contained in:
Michael Spalti
2023-01-09 10:32:49 -08:00
parent bbdef724e8
commit 357525e68a
2 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<ds-themed-loading *ngIf="(loading | async) || (isAuthenticated | async)" class="m-5"></ds-themed-loading>
<div *ngIf="!(loading | async) && !(isAuthenticated | async)" class="px-4 py-3 login-container">
<ng-container *ngFor="let authMethod of (authMethods | async); let i = index">
<ng-container *ngFor="let authMethod of (authMethods); let i = index">
<div *ngIf="i === 1" class="text-center mt-2">
<span class="align-middle">{{"login.form.or-divider" | translate}}</span>
</div>

View File

@@ -14,6 +14,7 @@ import { AuthService } from '../../core/auth/auth.service';
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
import { CoreState } from '../../core/core-state.model';
import { AuthMethodType } from '../../core/auth/models/auth.method-type';
/**
* /users/sign-in
@@ -36,7 +37,7 @@ export class LogInComponent implements OnInit {
* The list of authentication methods available
* @type {AuthMethod[]}
*/
public authMethods: Observable<AuthMethod[]>;
public authMethods: AuthMethod[];
/**
* Whether user is authenticated.
@@ -62,9 +63,12 @@ export class LogInComponent implements OnInit {
ngOnInit(): void {
this.authMethods = this.store.pipe(
this.store.pipe(
select(getAuthenticationMethods),
);
).subscribe(methods => {
// ignore the ip authentication method when it's returned by the backend
this.authMethods = methods.filter(a => a.authMethodType !== AuthMethodType.Ip)
});
// set loading
this.loading = this.store.pipe(select(isAuthenticationLoading));