mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-04-13 18:16:35 +00:00
feat: add ability to revoke passkeys of users as admin (#1386)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jose-d <7630424+jose-d@users.noreply.github.com> Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com> Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import userStore from '$lib/stores/user-store';
|
||||
import type { ListRequestOptions, Paginated } from '$lib/types/list-request.type';
|
||||
import type { Passkey } from '$lib/types/passkey.type';
|
||||
import type { SignupToken } from '$lib/types/signup-token.type';
|
||||
import type { UserGroup } from '$lib/types/user-group.type';
|
||||
import type { AccountUpdate, User, UserCreate, UserSignUp } from '$lib/types/user.type';
|
||||
@@ -33,6 +34,11 @@ export default class UserService extends APIService {
|
||||
return res.data as UserGroup[];
|
||||
};
|
||||
|
||||
listUserPasskeys = async (userId: string) => {
|
||||
const res = await this.api.get(`/users/${userId}/webauthn-credentials`);
|
||||
return res.data as Passkey[];
|
||||
};
|
||||
|
||||
update = async (id: string, user: UserCreate) => {
|
||||
const res = await this.api.put(`/users/${id}`, user);
|
||||
return res.data as User;
|
||||
@@ -47,6 +53,10 @@ export default class UserService extends APIService {
|
||||
await this.api.delete(`/users/${id}`);
|
||||
};
|
||||
|
||||
removeUserPasskey = async (userId: string, passkeyId: string) => {
|
||||
await this.api.delete(`/users/${userId}/webauthn-credentials/${passkeyId}`);
|
||||
};
|
||||
|
||||
updateProfilePicture = async (userId: string, image: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', image!);
|
||||
|
||||
Reference in New Issue
Block a user