mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-4139] Remove approve device logins setting and enable it by default (#9495)
* Remove login with device setting and enable it by default * Remove unused i18n message
This commit is contained in:
@@ -10,20 +10,6 @@ export abstract class AuthRequestServiceAbstraction {
|
||||
/** Emits an auth request id when an auth request has been approved. */
|
||||
authRequestPushNotification$: Observable<string>;
|
||||
|
||||
/**
|
||||
* Returns true if the user has chosen to allow auth requests to show on this client.
|
||||
* Intended to prevent spamming the user with auth requests.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract getAcceptAuthRequests: (userId: UserId) => Promise<boolean>;
|
||||
/**
|
||||
* Sets whether to allow auth requests to show on this client for this user.
|
||||
* @param accept Whether to allow auth requests to show on this client.
|
||||
* @param userId The user id.
|
||||
* @throws If `userId` is not provided.
|
||||
*/
|
||||
abstract setAcceptAuthRequests: (accept: boolean, userId: UserId) => Promise<void>;
|
||||
/**
|
||||
* Returns an admin auth request for the given user if it exists.
|
||||
* @param userId The user id.
|
||||
|
||||
@@ -62,15 +62,6 @@ describe("AuthRequestService", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("AcceptAuthRequests", () => {
|
||||
it("returns an error when userId isn't provided", async () => {
|
||||
await expect(sut.getAcceptAuthRequests(undefined)).rejects.toThrow("User ID is required");
|
||||
await expect(sut.setAcceptAuthRequests(true, undefined)).rejects.toThrow(
|
||||
"User ID is required",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("AdminAuthRequest", () => {
|
||||
it("returns an error when userId isn't provided", async () => {
|
||||
await expect(sut.getAdminAuthRequest(undefined)).rejects.toThrow("User ID is required");
|
||||
|
||||
@@ -22,20 +22,6 @@ import { MasterKey, UserKey } from "@bitwarden/common/types/key";
|
||||
|
||||
import { AuthRequestServiceAbstraction } from "../../abstractions/auth-request.service.abstraction";
|
||||
|
||||
/**
|
||||
* Disk-local to maintain consistency between tabs (even though
|
||||
* approvals are currently only available on desktop). We don't
|
||||
* want to clear this on logout as it's a user preference.
|
||||
*/
|
||||
export const ACCEPT_AUTH_REQUESTS_KEY = new UserKeyDefinition<boolean>(
|
||||
AUTH_REQUEST_DISK_LOCAL,
|
||||
"acceptAuthRequests",
|
||||
{
|
||||
deserializer: (value) => value ?? false,
|
||||
clearOn: [],
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* Disk-local to maintain consistency between tabs. We don't want to
|
||||
* clear this on logout since admin auth requests are long-lived.
|
||||
@@ -64,25 +50,6 @@ export class AuthRequestService implements AuthRequestServiceAbstraction {
|
||||
this.authRequestPushNotification$ = this.authRequestPushNotificationSubject.asObservable();
|
||||
}
|
||||
|
||||
async getAcceptAuthRequests(userId: UserId): Promise<boolean> {
|
||||
if (userId == null) {
|
||||
throw new Error("User ID is required");
|
||||
}
|
||||
|
||||
const value = await firstValueFrom(
|
||||
this.stateProvider.getUser(userId, ACCEPT_AUTH_REQUESTS_KEY).state$,
|
||||
);
|
||||
return value;
|
||||
}
|
||||
|
||||
async setAcceptAuthRequests(accept: boolean, userId: UserId): Promise<void> {
|
||||
if (userId == null) {
|
||||
throw new Error("User ID is required");
|
||||
}
|
||||
|
||||
await this.stateProvider.setUserState(ACCEPT_AUTH_REQUESTS_KEY, accept, userId);
|
||||
}
|
||||
|
||||
async getAdminAuthRequest(userId: UserId): Promise<AdminAuthRequestStorable | null> {
|
||||
if (userId == null) {
|
||||
throw new Error("User ID is required");
|
||||
|
||||
Reference in New Issue
Block a user