-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Ayshyama/auth-back-phil
Sign in and sign up backend
- Loading branch information
Showing
72 changed files
with
1,715 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from app_accounts.models import CustomUser | ||
|
||
|
||
@admin.register(CustomUser) | ||
class CustomUserAdmin(admin.ModelAdmin): | ||
list_display = ('email', 'username', 'first_name', 'last_name', 'is_staff', 'is_active') | ||
list_filter = ('is_staff', 'is_active') | ||
search_fields = ('email', 'username', 'first_name', 'last_name') | ||
ordering = ('email',) | ||
readonly_fields = ('date_joined', 'last_login') | ||
fieldsets = ( | ||
(None, {'fields': ('email', 'username', 'password')}), | ||
('Personal info', {'fields': ('first_name', 'last_name')}), | ||
('Permissions', | ||
{'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), | ||
('Important dates', {'fields': ('date_joined', 'last_login')}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('loginn/', views.UserLoginView.as_view(), name='account_login'), | ||
path('signupp/', views.UserSignupView.as_view(), name='account_signup'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
from django.shortcuts import render | ||
from allauth.account.views import LoginView, SignupView | ||
|
||
# Create your views here. | ||
|
||
class UserLoginView(LoginView): | ||
template_name = 'account/login_signup.html' | ||
success_url = '/' | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super().get_context_data(**kwargs) | ||
context['is_login'] = True | ||
context['form_login'] = context.pop('form') | ||
context['form_signup'] = SignupView.form_class() | ||
return context | ||
|
||
|
||
class UserSignupView(SignupView): | ||
template_name = 'account/login_signup.html' | ||
success_url = '/' | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super().get_context_data(**kwargs) | ||
context['is_login'] = False | ||
context['form_login'] = LoginView.form_class() | ||
context['form_signup'] = context.pop('form') | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
from django.contrib import admin | ||
from django.urls import path, include | ||
|
||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("", include("app_base.urls")), | ||
|
||
path('user/', include('allauth.urls')), | ||
path("user/", include("app_accounts.urls")), | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
asgiref==3.7.2 | ||
certifi==2023.11.17 | ||
cffi==1.16.0 | ||
charset-normalizer==3.3.2 | ||
cryptography==41.0.5 | ||
defusedxml==0.7.1 | ||
Django==4.2.5 | ||
django-allauth==0.58.2 | ||
idna==3.4 | ||
oauthlib==3.2.2 | ||
Pillow==10.1.0 | ||
psycopg2-binary==2.9.9 | ||
pycparser==2.21 | ||
PyJWT==2.8.0 | ||
python3-openid==3.2.0 | ||
requests==2.31.0 | ||
requests-oauthlib==1.3.1 | ||
sqlparse==0.4.4 | ||
typing_extensions==4.8.0 | ||
tzdata==2023.3 | ||
urllib3==2.1.0 |
Oops, something went wrong.