コード例 #1
0
 def form_valid(self, form):
     send_email_confirmation(self.request.user,
                             form.cleaned_data.get("email1"))
     notifications.info(
         self.request,
         _("your e-mail will be changed after the confirmation."),
         extra_tags="persistent")
     return redirect(self.success_url)
コード例 #2
0
 def form_valid(self, form):
     email = form.cleaned_data["email"]
     author = Author.objects.get(email=email)
     send_email_confirmation(author, email)
     notifications.info(
         self.request,
         _("a confirmation link has been sent to your e-mail address. by following"
           " this link you can activate and login into your account."),
     )
     return redirect("login")
コード例 #3
0
    def form_valid(self, form):
        user = form.save(commit=False)
        user.username = form.cleaned_data.get("username").lower()
        user.birth_date = form.cleaned_data.get("birth_date")
        user.gender = form.cleaned_data.get("gender")
        user.theme = get_theme_from_cookie(self.request)

        if settings.DISABLE_NOVICE_QUEUE:
            # Make the user an actual author
            user.application_status = Author.Status.APPROVED
            user.is_novice = False

        user.save()
        send_email_confirmation(user, user.email)
        notifications.info(
            self.request,
            _("a confirmation link has been sent to your e-mail address. by following"
              " this link you can activate and login into your account."),
        )
        return redirect("login")