Skip to content
Snippets Groups Projects
Commit d118d4ad authored by Raphael Das Gupta's avatar Raphael Das Gupta
Browse files

refactoring: rename function to "send_email_confirmation"

parent a7391ef8
No related branches found
No related tags found
1 merge request!850Feature/move _send_email_verification to models.profile
......@@ -10,7 +10,7 @@ from django.utils.translation import ugettext as _
RATE_LIMIT_SECONDS = 30
def _send_email_verification(request, profile):
def send_email_confirmation(request, profile):
if cache.get(profile.associated_user.id):
return
to_email = profile.unverified_email
......
......@@ -7,7 +7,7 @@ from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.views import generic
from osmaxx.profile.email_confirmation import _send_email_verification
from osmaxx.profile.email_confirmation import send_email_confirmation
from osmaxx.profile.forms import ProfileForm
from osmaxx.profile.models import Profile
......@@ -35,7 +35,7 @@ class ProfileView(LoginRequiredMixin, generic.UpdateView):
)
if self.is_new_user():
self._move_email_from_user_to_profile(user, profile)
_send_email_verification(self.request, profile)
send_email_confirmation(self.request, profile)
else:
self._ensure_profile_has_email(profile, user)
user.refresh_from_db()
......@@ -52,7 +52,7 @@ class ProfileView(LoginRequiredMixin, generic.UpdateView):
if isinstance(response, HttpResponseRedirect): # successful form validation
profile = Profile.objects.get(associated_user=self.request.user)
if not profile.has_validated_email():
_send_email_verification(self.request, profile=profile)
send_email_confirmation(self.request, profile=profile)
return response
def _ensure_profile_has_email(self, profile, user):
......@@ -101,7 +101,7 @@ class ResendVerificationEmail(LoginRequiredMixin, generic.RedirectView):
def get(self, request, *args, **kwargs):
profile = Profile.objects.get(associated_user=self.request.user)
_send_email_verification(self.request, profile=profile)
send_email_confirmation(self.request, profile=profile)
return super().get(request, *args, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment