mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-01-19 01:23:02 +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]})
|
raise serializers.ValidationError({"password": errors[0]})
|
||||||
else:
|
else:
|
||||||
raise serializers.ValidationError({"password": errors})
|
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(
|
raise serializers.ValidationError(
|
||||||
"A user with that username already exists."
|
"A user with that email already exists."
|
||||||
)
|
)
|
||||||
return super().validate(attrs)
|
return super().validate(attrs)
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@ FRONTEND_PORT = get_secret("FRONTEND_PORT")
|
||||||
# Full URLs
|
# Full URLs
|
||||||
BACKEND_URL = f"{URL_SCHEME}://{BACKEND_ADDRESS}"
|
BACKEND_URL = f"{URL_SCHEME}://{BACKEND_ADDRESS}"
|
||||||
FRONTEND_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
|
# Append port to full URLs if deployed locally
|
||||||
if not USE_HTTPS:
|
if not USE_HTTPS:
|
||||||
|
@ -233,7 +235,7 @@ SIMPLE_JWT = {
|
||||||
DJOSER = {
|
DJOSER = {
|
||||||
"SEND_ACTIVATION_EMAIL": True,
|
"SEND_ACTIVATION_EMAIL": True,
|
||||||
"SEND_CONFIRMATION_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}",
|
"ACTIVATION_URL": "activation/{uid}/{token}",
|
||||||
"USER_AUTHENTICATION_RULES": ["djoser.authentication.TokenAuthenticationRule"],
|
"USER_AUTHENTICATION_RULES": ["djoser.authentication.TokenAuthenticationRule"],
|
||||||
"SERIALIZERS": {
|
"SERIALIZERS": {
|
||||||
|
|
Loading…
Reference in a new issue