Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/fix biometric authentication registration (#2713)

Thomas Kaul833982a9de44
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d6b4486e3..fe3af1f462 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the language localization for Türkçe (`tr`)
- Upgraded `ng-extract-i18n-merge` from version `2.8.3` to `2.9.0`
+### Fixed
+
+- Fixed an issue in the biometric authentication registration
+
## 2.28.0 - 2023-12-02
### Added
diff --git a/apps/client/src/app/components/header/header.component.ts b/apps/client/src/app/components/header/header.component.ts
index 930c4910c4..a1f65f244a 100644
--- a/apps/client/src/app/components/header/header.component.ts
+++ b/apps/client/src/app/components/header/header.component.ts
@@ -15,7 +15,7 @@ import { LoginWithAccessTokenDialog } from '@ghostfolio/client/components/login-
import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import {
- STAY_SIGNED_IN,
+ KEY_STAY_SIGNED_IN,
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
@@ -196,7 +196,7 @@ export class HeaderComponent implements OnChanges {
public setToken(aToken: string) {
this.tokenStorageService.saveToken(
aToken,
- this.settingsStorageService.getSetting(STAY_SIGNED_IN) === 'true'
+ this.settingsStorageService.getSetting(KEY_STAY_SIGNED_IN) === 'true'
);
this.router.navigate(['/']);
diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts
index b3236b2be9..9f9fdbabd3 100644
--- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts
+++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.component.ts
@@ -4,7 +4,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { InternetIdentityService } from '@ghostfolio/client/services/internet-identity.service';
import {
- STAY_SIGNED_IN,
+ KEY_STAY_SIGNED_IN,
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
@@ -31,7 +31,7 @@ export class LoginWithAccessTokenDialog {
public onChangeStaySignedIn(aValue: MatCheckboxChange) {
this.settingsStorageService.setSetting(
- STAY_SIGNED_IN,
+ KEY_STAY_SIGNED_IN,
aValue.checked?.toString()
);
}
diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
index 3a1e02596f..eaf16e0155 100644
--- a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
+++ b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
@@ -8,7 +8,8 @@ import {
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { DataService } from '@ghostfolio/client/services/data.service';
import {
- STAY_SIGNED_IN,
+ KEY_STAY_SIGNED_IN,
+ KEY_TOKEN,
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service';
@@ -241,7 +242,8 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit {
})
)
.subscribe(() => {
- this.settingsStorageService.removeSetting(STAY_SIGNED_IN);
+ this.settingsStorageService.removeSetting(KEY_STAY_SIGNED_IN);
+ this.settingsStorageService.removeSetting(KEY_TOKEN);
this.update();
});
diff --git a/apps/client/src/app/pages/auth/auth-page.component.ts b/apps/client/src/app/pages/auth/auth-page.component.ts
index 75702c0965..1dc4947738 100644
--- a/apps/client/src/app/pages/auth/auth-page.component.ts
+++ b/apps/client/src/app/pages/auth/auth-page.component.ts
@@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import {
- STAY_SIGNED_IN,
+ KEY_STAY_SIGNED_IN,
SettingsStorageService
} from '@ghostfolio/client/services/settings-storage.service';
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
@@ -31,7 +31,7 @@ export class AuthPageComponent implements OnDestroy, OnInit {
this.tokenStorageService.saveToken(
jwt,
- this.settingsStorageService.getSetting(STAY_SIGNED_IN) === 'true'
+ this.settingsStorageService.getSetting(KEY_STAY_SIGNED_IN) === 'true'
);
this.router.navigate(['/']);
diff --git a/apps/client/src/app/services/settings-storage.service.ts b/apps/client/src/app/services/settings-storage.service.ts
index a340f89b7a..abb49ea2da 100644
--- a/apps/client/src/app/services/settings-storage.service.ts
+++ b/apps/client/src/app/services/settings-storage.service.ts
@@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
-export const RANGE = 'range';
-export const STAY_SIGNED_IN = 'staySignedIn';
+export const KEY_RANGE = 'range';
+export const KEY_STAY_SIGNED_IN = 'staySignedIn';
+export const KEY_TOKEN = 'auth-token';
@Injectable({
providedIn: 'root'
diff --git a/apps/client/src/app/services/token-storage.service.ts b/apps/client/src/app/services/token-storage.service.ts
index 5980f56e10..b6af7350fe 100644
--- a/apps/client/src/app/services/token-storage.service.ts
+++ b/apps/client/src/app/services/token-storage.service.ts
@@ -1,10 +1,9 @@
import { Injectable } from '@angular/core';
import { WebAuthnService } from '@ghostfolio/client/services/web-authn.service';
+import { KEY_TOKEN } from './settings-storage.service';
import { UserService } from './user/user.service';
-const TOKEN_KEY = 'auth-token';
-
@Injectable({
providedIn: 'root'
})
@@ -16,16 +15,16 @@ export class TokenStorageService {
public getToken(): string {
return (
- window.sessionStorage.getItem(TOKEN_KEY) ||
- window.localStorage.getItem(TOKEN_KEY)
+ window.sessionStorage.getItem(KEY_TOKEN) ||
+ window.localStorage.getItem(KEY_TOKEN)
);
}
public saveToken(token: string, staySignedIn = false): void {
if (staySignedIn) {
- window.localStorage.setItem(TOKEN_KEY, token);
+ window.localStorage.setItem(KEY_TOKEN, token);
}
- window.sessionStorage.setItem(TOKEN_KEY, token);
+ window.sessionStorage.setItem(KEY_TOKEN, token);
}
public signOut(): void {