Bugfix/fix biometric authentication registration (#2713)

* Remove token on device registration

* Update changelog
pull/2726/head
Thomas Kaul 10 months ago committed by GitHub
parent c85966e5ed
commit 833982a9de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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(['/']);

@ -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()
);
}

@ -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();
});

@ -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(['/']);

@ -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'

@ -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 {

Loading…
Cancel
Save