Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
cleanup files
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Sep 24, 2024
1 parent c1a0b13 commit 13c5932
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
4 changes: 3 additions & 1 deletion backoffice/.envs/local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython


# Redis
# ------------------------------------------------------------------------------
REDIS_URL=redis://redis:6379/0
Expand All @@ -25,3 +24,6 @@ AIRFLOW_BASE_URL=http://airflow-webserver:8080
AIRFLOW_TOKEN=YWlyZmxvdzphaXJmbG93

SERVICENOW_URL=https://cerntraining.service-now.com

# Frontend
FRONTEND_LOGIN_SUCCESS=http://127.0.0.1:5000/success
2 changes: 0 additions & 2 deletions backoffice/backoffice/users/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ def is_open_for_signup(
) -> bool:
return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)



def populate_user(
self,
request: HttpRequest,
Expand Down
7 changes: 0 additions & 7 deletions backoffice/backoffice/users/api/views.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import requests
from urllib.parse import urljoin
from django.urls import reverse

from allauth.socialaccount.providers.oauth2.client import OAuth2Client
from allauth.socialaccount.providers.orcid.views import OrcidOAuth2Adapter
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin, UpdateModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet
from rest_framework.views import APIView
from backoffice.users.api.serializers import UserSerializer

User = get_user_model()
Expand Down
6 changes: 0 additions & 6 deletions backoffice/backoffice/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,4 @@ class UserRedirectView(LoginRequiredMixin, RedirectView):
def get_redirect_url(self):
return reverse("users:detail", kwargs={"pk": self.request.user.pk})

def success(request):
import ipdb;ipdb.set_trace()
return JsonResponse(data={"wow":request.user.email})

user_redirect_view = UserRedirectView.as_view()


16 changes: 3 additions & 13 deletions backoffice/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,19 @@
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth.headless",
"allauth.socialaccount.providers.orcid",
"django_celery_beat",
"rest_framework",
"rest_framework.authtoken",
"corsheaders",
"drf_spectacular",
"allauth.socialaccount.providers.orcid",
"django_prometheus",
"django_opensearch_dsl",
"django_elasticsearch_dsl_drf",
"rest_framework_simplejwt",
"django_json_widget",
]

REST_AUTH = {
"SESSION_LOGIN": True,
"USE_JWT": True,
"JWT_AUTH_COOKIE": "auth",
'JWT_AUTH_REFRESH_COOKIE': 'my-refresh-token',
"JWT_AUTH_HTTPONLY": False,
}

LOCAL_APPS = ["backoffice.users", "backoffice.workflows", "backoffice.management"]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
Expand All @@ -136,7 +128,7 @@
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
AUTH_USER_MODEL = "users.User"
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "http://127.0.0.1:5000/success"
LOGIN_REDIRECT_URL = env("FRONTEND_LOGIN_SUCCESS")
# https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = "account_login"

Expand Down Expand Up @@ -340,7 +332,7 @@
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_EMAIL_VERIFICATION = False
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_ADAPTER = "backoffice.users.adapters.AccountAdapter"
# https://django-allauth.readthedocs.io/en/latest/forms.html
Expand Down Expand Up @@ -391,8 +383,6 @@
"BASE_DOMAIN": "sandbox.orcid.org"
}
}
SOCIALACCOUNT_EMAIL_VERIFICATION = False
ACCOUNT_EMAIL_VERIFICATION = False


# Opensearch
Expand Down
3 changes: 0 additions & 3 deletions backoffice/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from rest_framework.authtoken.views import obtain_auth_token
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from backoffice.users.views import success

urlpatterns = [
path("", TemplateView.as_view(template_name="pages/home.html"), name="home"),
Expand All @@ -32,7 +31,6 @@
# API URLS
urlpatterns += [
# API base url
path("accounts/login/success/",success),
path("api/oauth/authorized/orcid/", oauth2_callback, name="orcid_callback"),
path("api/", include("config.search_router")),
path("api/", include("config.api_router")),
Expand All @@ -46,7 +44,6 @@
),
path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
path("_allauth/", include("allauth.headless.urls")),
]


Expand Down

0 comments on commit 13c5932

Please sign in to comment.