From 2e597a71768800f0b4f6225f4b100fc5b2cc63c0 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Sat, 30 Dec 2023 11:48:47 +0100 Subject: [PATCH] Feature: OIDC support --- Pipfile | 1 + Pipfile.lock | 8 ++ .../profile-edit-dialog.component.html | 30 ++++++ .../profile-edit-dialog.component.spec.ts | 72 +++++++++++++ .../profile-edit-dialog.component.ts | 26 +++++ src-ui/src/app/data/user-profile.ts | 12 +++ .../src/app/services/profile.service.spec.ts | 16 +++ src-ui/src/app/services/profile.service.ts | 18 +++- src/documents/tests/test_api_profile.py | 50 +++++++++ src/paperless/adapter.py | 26 +++++ src/paperless/serialisers.py | 22 ++++ src/paperless/settings.py | 35 ++++++ src/paperless/templates/account/login.html | 100 ++++++++++++++++++ .../templates/socialaccount/login.html | 52 +++++++++ .../templates/socialaccount/signup.html | 77 ++++++++++++++ src/paperless/urls.py | 12 ++- src/paperless/views.py | 54 ++++++++++ 17 files changed, 609 insertions(+), 2 deletions(-) create mode 100644 src/paperless/adapter.py create mode 100644 src/paperless/templates/account/login.html create mode 100644 src/paperless/templates/socialaccount/login.html create mode 100644 src/paperless/templates/socialaccount/signup.html diff --git a/Pipfile b/Pipfile index afc294412..6d5c7f861 100644 --- a/Pipfile +++ b/Pipfile @@ -8,6 +8,7 @@ dateparser = "~=1.2" # WARNING: django does not use semver. # Only patch versions are guaranteed to not introduce breaking changes. django = "~=4.2.9" +django-allauth = "*" django-auditlog = "*" django-celery-results = "*" django-compression-middleware = "*" diff --git a/Pipfile.lock b/Pipfile.lock index ceef1c8a9..d177517c2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -452,6 +452,14 @@ "markers": "python_version >= '3.8'", "version": "==4.2.9" }, + "django-allauth": { + "hashes": [ + "sha256:ec19efb80b34d2f18bd831eab9b10b6301f58d1cce9f39af35f497b7e5b0a141" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==0.59.0" + }, "django-auditlog": { "hashes": [ "sha256:7bc2c87e4aff62dec9785d1b2359a2b27148f8c286f8a52b9114fc7876c5a9f7", 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 394ba4449..b1b91b31e 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 @@ -49,6 +49,36 @@
Warning: changing the token cannot be undone
+ @if (socialAccounts?.length > 0) { +
+

Connected social accounts

+
+
    + @for (account of socialAccounts; track account.id) { +
  • {{account.name}}
  • + } +
+
Warning: changing the social accounts cannot be undone
+
+
+ } + @if (socialAccountProviders?.length > 0) { +
+

Available social account providers

+
+
    + @for (provider of socialAccountProviders; track provider.name) { +
  • {{provider.name}}
  • + } +
+
Warning: changing the social account providers cannot be undone
+
+
+ }