mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-09 09:51:02 +01:00
Fix new device login (#664)
* Store appId in localStorage * Save to local as well
This commit is contained in:
parent
99f70bea8d
commit
52f77c0277
@ -2,6 +2,7 @@ import { Utils } from "../misc/utils";
|
|||||||
|
|
||||||
import { AppIdService as AppIdServiceAbstraction } from "../abstractions/appId.service";
|
import { AppIdService as AppIdServiceAbstraction } from "../abstractions/appId.service";
|
||||||
import { StorageService } from "../abstractions/storage.service";
|
import { StorageService } from "../abstractions/storage.service";
|
||||||
|
import { HtmlStorageLocation } from "../enums/htmlStorageLocation";
|
||||||
|
|
||||||
export class AppIdService implements AppIdServiceAbstraction {
|
export class AppIdService implements AppIdServiceAbstraction {
|
||||||
constructor(private storageService: StorageService) {}
|
constructor(private storageService: StorageService) {}
|
||||||
@ -15,13 +16,17 @@ export class AppIdService implements AppIdServiceAbstraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async makeAndGetAppId(key: string) {
|
private async makeAndGetAppId(key: string) {
|
||||||
const existingId = await this.storageService.get<string>(key);
|
const existingId = await this.storageService.get<string>(key, {
|
||||||
|
htmlStorageLocation: HtmlStorageLocation.Local,
|
||||||
|
});
|
||||||
if (existingId != null) {
|
if (existingId != null) {
|
||||||
return existingId;
|
return existingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const guid = Utils.newGuid();
|
const guid = Utils.newGuid();
|
||||||
await this.storageService.save(key, guid);
|
await this.storageService.save(key, guid, {
|
||||||
|
htmlStorageLocation: HtmlStorageLocation.Local,
|
||||||
|
});
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user