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:
0
backend/wheretogo/accounts/__init__.py
Normal file
0
backend/wheretogo/accounts/__init__.py
Normal file
3
backend/wheretogo/accounts/admin.py
Normal file
3
backend/wheretogo/accounts/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
8
backend/wheretogo/accounts/apps.py
Normal file
8
backend/wheretogo/accounts/apps.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext_lazy
|
||||
|
||||
|
||||
class AuthConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "accounts"
|
||||
verbose_name = gettext_lazy("accounts")
|
||||
0
backend/wheretogo/accounts/migrations/__init__.py
Normal file
0
backend/wheretogo/accounts/migrations/__init__.py
Normal file
3
backend/wheretogo/accounts/models.py
Normal file
3
backend/wheretogo/accounts/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
backend/wheretogo/accounts/tests.py
Normal file
3
backend/wheretogo/accounts/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
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
|
||||
Reference in New Issue
Block a user