-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add user authentication backend, admin customizations, and test…
… authentication endpoint
- Loading branch information
1 parent
36ce8cb
commit e5f3fb2
Showing
21 changed files
with
591 additions
and
278 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
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
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,2 @@ | ||
# apps/users/__init__.py | ||
default_app_config = 'apps.users.apps.UsersConfig' |
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,13 @@ | ||
from django.contrib import admin | ||
from django.contrib.auth import get_user_model | ||
from .user_admin import UserAdmin | ||
|
||
User = get_user_model() | ||
|
||
# Register the User model with the custom admin | ||
admin.site.register(User, UserAdmin) | ||
|
||
# Admin site customization | ||
admin.site.site_header = "Egypt Metro Administration" | ||
admin.site.site_title = "Egypt Metro Admin Portal" | ||
admin.site.index_title = "Welcome to Egypt Metro Admin Portal" |
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
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,15 @@ | ||
# apps/users/views/auth_test.py | ||
|
||
from django.http import JsonResponse | ||
from django.contrib.auth.decorators import login_required | ||
|
||
|
||
@login_required | ||
def test_auth(request): | ||
"""Test authentication status.""" | ||
return JsonResponse({ | ||
'authenticated': True, | ||
'user': request.user.email, | ||
'is_superuser': request.user.is_superuser, | ||
'is_staff': request.user.is_staff | ||
}) |
Oops, something went wrong.