-
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.
Merge pull request #17 from iurwpoietknckvjndfsm-gndvkd/authentication
Activation email endpoint & Login with email
- Loading branch information
Showing
10 changed files
with
90 additions
and
29 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.contrib import admin | ||
|
||
from .models import User | ||
|
||
|
||
@admin.register(User) | ||
class UserAdmin(admin.ModelAdmin): | ||
list_display = ["id", "username", "email", "is_active"] |
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,5 @@ | ||
import re | ||
|
||
|
||
def check_password_strength(password): | ||
return re.match(r"^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])", password) |
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,7 +1,9 @@ | ||
from django.urls import include, path | ||
from djoser.views import UserViewSet | ||
|
||
app_name = "users" | ||
urlpatterns = [ | ||
path("auth/api/", include("djoser.urls")), | ||
path("auth/api/", include("djoser.urls.jwt")), | ||
path("auth/api/users/activation/<str:uid>/<str:token>", UserViewSet().activation), | ||
] |
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,20 @@ | ||
import pytest | ||
from rest_framework.test import APIClient | ||
|
||
from agriwise.users.models import User | ||
|
||
|
||
@pytest.fixture | ||
def user(db) -> User: | ||
return User.objects.create_user( | ||
username="username1", | ||
email="username1@email.com", | ||
password="sh0123456789123456", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def auth_client(user): | ||
client = APIClient() | ||
client.force_authenticate(user) | ||
return client |
This file was deleted.
Oops, something went wrong.
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