You've already forked WhereToGoRedux
mirror of
https://github.com/Llloooggg/WhereToGoRedux.git
synced 2026-03-06 04:56:23 +03:00
[backend + frontend]: Добавлена базовая регистрация
This commit is contained in:
@@ -4,5 +4,5 @@ from django.utils.translation import gettext_lazy
|
||||
|
||||
class AuthConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "authentication"
|
||||
verbose_name = gettext_lazy("authentication")
|
||||
name = "accounts"
|
||||
verbose_name = gettext_lazy("accounts")
|
||||
14
backend/wheretogo/accounts/urls.py
Normal file
14
backend/wheretogo/accounts/urls.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.urls import path
|
||||
from django.urls import include
|
||||
|
||||
from accounts.views import CustomTokenObtainPairView
|
||||
|
||||
urlpatterns = [
|
||||
path("", include("djoser.urls")),
|
||||
path(
|
||||
"auth/jwt/create",
|
||||
CustomTokenObtainPairView.as_view(),
|
||||
name="custom_token_obtain_pair",
|
||||
),
|
||||
path("auth/", include("djoser.urls.jwt")),
|
||||
]
|
||||
13
backend/wheretogo/accounts/views.py
Normal file
13
backend/wheretogo/accounts/views.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
||||
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||
|
||||
|
||||
class CustomTokenObtainPairSerializer(TokenObtainPairSerializer):
|
||||
def validate(self, attrs):
|
||||
data = super().validate(attrs)
|
||||
data["username"] = self.user.username
|
||||
return data
|
||||
|
||||
|
||||
class CustomTokenObtainPairView(TokenObtainPairView):
|
||||
serializer_class = CustomTokenObtainPairSerializer
|
||||
@@ -1,9 +0,0 @@
|
||||
from django.urls import path
|
||||
|
||||
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||
from rest_framework_simplejwt.views import TokenRefreshView
|
||||
|
||||
urlpatterns = [
|
||||
path("token", TokenObtainPairView.as_view(), name="token_obtain_pair"),
|
||||
path("token/refresh", TokenRefreshView.as_view(), name="token_refresh"),
|
||||
]
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-09-10 14:48+0300\n"
|
||||
"POT-Creation-Date: 2022-09-12 23:55+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -20,6 +20,10 @@ msgstr ""
|
||||
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
|
||||
"%100>=11 && n%100<=14)? 2 : 3);\n"
|
||||
|
||||
#: accounts/apps.py:8
|
||||
msgid "accounts"
|
||||
msgstr "аккаунты"
|
||||
|
||||
#: facilities/apps.py:8 facilities/models.py:18
|
||||
msgid "facilities"
|
||||
msgstr "заведения"
|
||||
|
||||
@@ -43,11 +43,11 @@ INSTALLED_APPS = [
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.gis",
|
||||
"djoser",
|
||||
"rest_framework",
|
||||
"rest_framework_simplejwt",
|
||||
"rest_framework_gis",
|
||||
"corsheaders",
|
||||
"authentication",
|
||||
"accounts",
|
||||
"facilities",
|
||||
]
|
||||
|
||||
@@ -128,9 +128,12 @@ STATIC_URL = "static/"
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_AUTHENTICATION_CLASSES": (
|
||||
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
SIMPLE_JWT = {
|
||||
"AUTH_HEADER_TYPES": ("JWT",),
|
||||
}
|
||||
|
||||
@@ -11,3 +11,7 @@ DATABASES = {
|
||||
"PORT": "5432",
|
||||
}
|
||||
}
|
||||
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
"http://localhost:8080",
|
||||
]
|
||||
|
||||
@@ -19,6 +19,6 @@ from django.urls import include
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("api/auth/", include("authentication.urls")),
|
||||
path("api/accounts/", include("accounts.urls")),
|
||||
path("api/facilities/", include("facilities.urls")),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user