Beispiel #1
0
    def save(self):
        user = User.objects.get(username=self.cleaned_data["username"].lower())
        user.set_password(self.cleaned_data["password2"])
        user.save()
        plan = self.cleaned_data["subscription"]

        trial = check_trial_eligibility(plan, user)
        if trial:
            url = return_url(plan, user, trial=True)
        else:
            url = subscription_url(plan, user)

        send_mail(
            spreedly_settings.SPREEDLY_CONFIRM_EMAIL_SUBJECT,
            render_to_string(
                spreedly_settings.SPREEDLY_CONFIRM_EMAIL,
                {"plan": plan, "user": user, "site": Site.objects.get(id=settings.SITE_ID), "spreedly_url": url},
            ),
            settings.DEFAULT_FROM_EMAIL,
            [user.email],
        )
        return reverse("spreedly_email_sent", args=[user.id])
Beispiel #2
0
 def save(self):
     user = User.objects.get(username=self.cleaned_data["username"].lower())
     user.set_password(self.cleaned_data["password2"])
     user.save()
     plan = self.cleaned_data["subscription"]
     
     trial = check_trial_eligibility(plan, user)
     if trial:
         url = return_url(plan.pk, user, trial=True)
     else:
         url = subscription_url(plan, user)
     
     send_mail(
         spreedly_settings.SPREEDLY_CONFIRM_EMAIL_SUBJECT,
         render_to_string(spreedly_settings.SPREEDLY_CONFIRM_EMAIL, {
             'plan_name': plan.name,
             'user': user,
             'site': spreedly_settings.SPREEDLY_SITE_URL,
             'spreedly_url': url
         }),
         settings.DEFAULT_FROM_EMAIL,
         [user.email,]
     )
     return reverse('spreedly_email_sent', args=[user.id])
def new_plan_url(plan, user):
    return subscription_url(plan, user, return_url(user, plan))