mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-01-18 17:13:00 +08:00
Minor fixes to registration and emails
This commit is contained in:
parent
463e33d219
commit
65662aeb45
2 changed files with 5 additions and 3 deletions
|
@ -46,9 +46,9 @@ class CustomUserRegistrationSerializer(serializers.ModelSerializer):
|
|||
raise serializers.ValidationError({"password": errors[0]})
|
||||
else:
|
||||
raise serializers.ValidationError({"password": errors})
|
||||
if self.Meta.model.objects.filter(username=attrs.get("username")).exists():
|
||||
if self.Meta.model.objects.filter(username=attrs.get("email")).exists():
|
||||
raise serializers.ValidationError(
|
||||
"A user with that username already exists."
|
||||
"A user with that email already exists."
|
||||
)
|
||||
return super().validate(attrs)
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ FRONTEND_PORT = get_secret("FRONTEND_PORT")
|
|||
# Full URLs
|
||||
BACKEND_URL = f"{URL_SCHEME}://{BACKEND_ADDRESS}"
|
||||
FRONTEND_URL = f"{URL_SCHEME}://{BACKEND_ADDRESS}"
|
||||
# Used for emails
|
||||
DOMAIN = f"{FRONTEND_ADDRESS}:{FRONTEND_PORT}/#"
|
||||
|
||||
# Append port to full URLs if deployed locally
|
||||
if not USE_HTTPS:
|
||||
|
@ -233,7 +235,7 @@ SIMPLE_JWT = {
|
|||
DJOSER = {
|
||||
"SEND_ACTIVATION_EMAIL": True,
|
||||
"SEND_CONFIRMATION_EMAIL": True,
|
||||
"PASSWORD_RESET_CONFIRM_URL": "reset_password_confirm/{uid}/{token}",
|
||||
"PASSWORD_RESET_CONFIRM_URL": "reset_password/confirm/{uid}/{token}",
|
||||
"ACTIVATION_URL": "activation/{uid}/{token}",
|
||||
"USER_AUTHENTICATION_RULES": ["djoser.authentication.TokenAuthenticationRule"],
|
||||
"SERIALIZERS": {
|
||||
|
|
Loading…
Reference in a new issue