From f90bd4722c6e8588dace451eac0095a0fd4dc32e Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 23 Nov 2023 00:15:18 -0800 Subject: [PATCH] Include auth token and generate auth token --- docs/api.md | 6 ++- .../profile-edit-dialog.component.html | 21 ++++++++ .../profile-edit-dialog.component.scss | 4 ++ .../profile-edit-dialog.component.spec.ts | 49 +++++++++++++++++-- .../profile-edit-dialog.component.ts | 47 ++++++++++++++---- src-ui/src/app/data/user-profile.ts | 1 + .../src/app/services/profile.service.spec.ts | 8 +++ src-ui/src/app/services/profile.service.ts | 7 +++ src/documents/tests/test_api.py | 25 +++++++++- src/paperless/serialisers.py | 4 +- src/paperless/urls.py | 2 + src/paperless/views.py | 42 ++++++++++------ 12 files changed, 185 insertions(+), 31 deletions(-) diff --git a/docs/api.md b/docs/api.md index cbf94cf6a..8096b84e9 100644 --- a/docs/api.md +++ b/docs/api.md @@ -158,6 +158,10 @@ The REST api provides three different forms of authentication. 3. Token authentication + You can create (or re-create) an API token by opening the "My Profile" + link in the user dropdown found in the web UI and clicking the circular + arrow button. + Paperless also offers an endpoint to acquire authentication tokens. POST a username and password as a form or json string to @@ -169,7 +173,7 @@ The REST api provides three different forms of authentication. Authorization: Token ``` - Tokens can be managed and revoked in the paperless admin. + Tokens can also be managed in the Django admin. ## Searching for documents diff --git a/src-ui/src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html b/src-ui/src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html index cfeb24b3b..d76ace8ba 100644 --- a/src-ui/src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html +++ b/src-ui/src/app/components/common/profile-edit-dialog/profile-edit-dialog.component.html @@ -27,6 +27,27 @@ +
+ +
+
+ + + +
+ Copied! +
+
Warning: changing the token cannot be undone
+