Am using Djoser for authentication in my project. Have been struggling to add email activation for over 4 days now but seems have failed to grab it fine as the documentation is a little hard for me to understand.
This is my code settings.py
#change auth model to custom model
AUTH_USER_MODEL = 'userauth.User'
#setting up email server
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'codemanuzmaster'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = '[email protected]'
#djoser login settings
DJOSER = {
'DOMAIN': 'localhost:8000',
'SITE_NAME': 'net',
'LOGIN_FIELD':'email',
'USER_CREATE_PASSWORD_RETYPE':True,
'ACTIVATION_URL': '#/users/activate/{uid}/{token}',
'SEND_ACTIVATION_EMAIL': True,
'SERIALIZERS':{
'user_create':'userauth.serializers.UserCreateSerializer',
'user':'userauth.serializers.UserCreateSerializer',
'activation': 'djoser.email.ActivationEmail',
}
}
here is the email i receive after creating user
http://example.com/auth/users/activate/MQ/5c9-26bcab9e85e8a967731d
It shows example.com but i want it to change the web url to localhost:8000 instead
You're receiving this email because you need to finish activation process on example.com.
Please go to the following page to activate account:
http://example.com/auth/users/activate/MQ/5c9-26bcab9e85e8a967731d
And if i change the web url manually to
http://127.0.0.1:8000/users/activate/MQ/5c9-26bcab9e85e8a967731d
it keeps returning
{
"detail": "Authentication credentials were not provided."
}
I really request you people to help me.