diff --git a/components/User/AdminUserProfilePage.vue b/components/User/AdminUserProfilePage.vue index 69cae6497..9383183c8 100644 --- a/components/User/AdminUserProfilePage.vue +++ b/components/User/AdminUserProfilePage.vue @@ -75,73 +75,6 @@ {{ $t('Sauvegarder') }} -
- -
-
-
- -
- -
-
-
-
-
- - {{ $t('Regénérer') }} - {{ $t('Générer') }} - -
-
- - {{ $t('Supprimer') }} - -
-
-
-
+
diff --git a/components/User/ApiTokensSection.vue b/components/User/ApiTokensSection.vue new file mode 100644 index 000000000..ad343a93c --- /dev/null +++ b/components/User/ApiTokensSection.vue @@ -0,0 +1,163 @@ + + + diff --git a/components/User/CreateApiTokenModal.vue b/components/User/CreateApiTokenModal.vue new file mode 100644 index 000000000..ef6eeb25d --- /dev/null +++ b/components/User/CreateApiTokenModal.vue @@ -0,0 +1,92 @@ + + + diff --git a/datagouv-components/src/types/users.ts b/datagouv-components/src/types/users.ts index 0664c7760..4b9e74a6b 100644 --- a/datagouv-components/src/types/users.ts +++ b/datagouv-components/src/types/users.ts @@ -21,7 +21,6 @@ export type User = { page: UserReference['page'] avatar: UserReference['avatar'] avatar_thumbnail: UserReference['avatar_thumbnail'] - apikey?: string email?: string about: string website?: string diff --git a/types/api-tokens.ts b/types/api-tokens.ts new file mode 100644 index 000000000..73193410b --- /dev/null +++ b/types/api-tokens.ts @@ -0,0 +1,15 @@ +export type ApiToken = { + id: string + token_prefix: string + name: string | null + scope: 'admin' + kind: 'api_key' + created_at: string + last_used_at: string | null + user_agents: string[] + expires_at: string | null +} + +export type ApiTokenCreated = ApiToken & { + token: string +} diff --git a/utils/auth.ts b/utils/auth.ts index 554321dfc..e6b8b8de9 100644 --- a/utils/auth.ts +++ b/utils/auth.ts @@ -4,7 +4,6 @@ import { usePostApiWithCsrf } from './api' export type Me = User & { about: string | null active: boolean - apikey: string | null email: string metrics: { datasets: number