Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion authors/apps/authentication/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class RegistrationSerializer(serializers.ModelSerializer):
write_only=True,
required=True,
validators=[RegexValidator(
regex="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$",
# ^[A-Za-z0-9!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?±§~`]+$
regex="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?±§~`\]+]{8,}$",
message="Please ensure your password contains at least one letter and one numeral",
code='invalid_password')],

Expand Down
18 changes: 18 additions & 0 deletions authors/apps/authentication/tests/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,21 @@ def test_signup_nonalphanumeric_password(self):
'Please ensure your password contains at least one letter and one numeral', str(output)
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

def test_signup_special_character_password(self):
"""
test for request with a non alphanumeric password
"""
response = self.client.post(
reverse('authentication:user-signup'),
data={
"user": {
"email": "tester3@mail.com",
"username": "tester3",
"password": "Tester1234#&&*±§"
}
},
format="json"
)
output = json.loads(response.content)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
7 changes: 0 additions & 7 deletions authors/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,4 @@
namespace='bookmark'
)
),
path(
'api/',
include(
('authors.apps.stats.urls', 'authors.apps.stats'),
namespace="stats"
)
)
]