When I am registering as a new user or want to change my password, then the Message which is needed to be sent to the email is showing in the terminal instead. Here is the terminal picture:
Here is the views.py function.
from aiohttp import request
from django.contrib.sites.models import Site
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from companies.models import Company
from accounts.roles import UserRole
# User mode
from .models import CustomUser
from domains.models import Domain
from dashboard.models import MarketingHome, SliderHome
# Custom forms
from .forms import PublicCustomUserChangeForm, CustomChangePasswordForm
from django.contrib.auth import views as auth_views
from django.shortcuts import resolve_url
from allauth.account.views import SignupView, LoginView
@login_required
def change_password_user(request):
company = CustomUser.get_company(request.user)
if request.method == "GET":
form = CustomChangePasswordForm(request.user)
context = {
'form': form,
'company': company
}
return render(request, 'account/change_password_user.html', context)
else:
form = CustomChangePasswordForm(request.user, request.POST)
if form.is_valid():
form.save()
# update_session_auth_hash(request, user)
messages.success(request, 'Your password was successfully updated!')
return redirect('account_change_password_user')
else:
messages.error(request, form.errors)
return redirect('account_change_password_user')
here is the registration function:
class AccountSignupView(SignupView):
template_name = "account/signup.html"
def get_context_data(self, **kwargs):
current_site = self.request.META['HTTP_HOST']
context = super(SignupView, self).get_context_data(**kwargs)
context = {
'slider': SliderHome.objects.filter(domain_site__domain__contains=current_site, is_active=True),
# 'current_domain': Domain.objects.filter(site__domain__contains=current_site).first()
}
return context
account_signup_view = AccountSignupView.as_view()
You may be using EMAIL_BACKEND
in settings.py
as this way:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Instead change it to your desired email backend.
Example -
'django.core.mail.backends.filebased.EmailBackend'
'django.core.mail.backends.smtp.EmailBackend'