def save(self, domain_override=None, subject_template_name='registration/activation_subject.txt', email_template_name='registration/activation_email.txt', use_https=False, token_generator=default_token_generator, from_email=None, request=None, html_email_template_name=None, extra_email_context=None): user = super(CreateUserForm, self).save(commit=False) user.username = user.email user.is_active = False user.save() context = { 'request': request, 'protocol': request.scheme, 'username': self.cleaned_data.get('username'), 'domain': request.META['HTTP_HOST'], 'uid': urlsafe_base64_encode(force_bytes(user.id)), 'token': default_token_generator.make_token(user), } send_multi_mail(subject_template_name, email_template_name, context, from_email, user.email, html_email_template_name=html_email_template_name) return user
def on_trial_will_end(self, request, user, stripe_object): if self.trial_will_end_email_template_name is None or self.trial_will_end_subject_template_name is None: return context = { 'request': request, 'user': user, 'trial': stripe_object, 'protocol': request.scheme, 'domain': request.META['HTTP_HOST'], } send_multi_mail(self.trial_will_end_subject_template_name, self.trial_will_end_email_template_name, context, self.from_email, user.email, html_email_template_name=self. html_trial_will_end_email_template_name)
def on_payment_failed(self, request, user, billing, stripe_object): if self.payment_failed_email_template_name is None or self.payment_failed_subject_template_name is None: return context = { 'request': request, 'user': user, 'billing': billing, 'payment': stripe_object, 'protocol': request.scheme, 'domain': request.META['HTTP_HOST'], } send_multi_mail(self.payment_failed_subject_template_name, self.payment_failed_email_template_name, context, self.from_email, user.email, html_email_template_name=self. html_payment_failed_email_template_name)