コード例 #1
0
ファイル: forms.py プロジェクト: shackra/django-allauth
 def save(self, request):
     new_user = self.create_user()
     super(SignupForm, self).save(new_user)
     setup_user_email(request, new_user)
     send_email_confirmation(request, new_user)
     self.after_signup(new_user)
     return new_user
コード例 #2
0
ファイル: decorators.py プロジェクト: Rundll/django-allauth
 def _wrapped_view(request, *args, **kwargs):
     if not EmailAddress.objects.filter(user=request.user,
                                        verified=True).exists():
         send_email_confirmation(request.user, request)
         return render(request,
                       'account/verified_email_required.html')
     return view_func(request, *args, **kwargs)
コード例 #3
0
 def save(self, request):
     new_user = self.create_user()
     super(SignupForm, self).save(new_user)
     setup_user_email(request, new_user)
     send_email_confirmation(request, new_user)
     self.after_signup(new_user)
     return new_user
コード例 #4
0
ファイル: forms.py プロジェクト: letolab/django-allauth
    def save(self, request=None):
        # don't assume a username is available. it is a common removal if
        # site developer wants to use e-mail authentication.
        email = self.cleaned_data["email"]

        if self.cleaned_data.get("confirmation_key"):
            from friends.models import JoinInvitation  # @@@ temporary fix for issue 93
            try:
                join_invitation = JoinInvitation.objects.get(
                    confirmation_key=self.cleaned_data["confirmation_key"])
                confirmed = True
            except JoinInvitation.DoesNotExist:
                confirmed = False
        else:
            confirmed = False

        # @@@ clean up some of the repetition below -- DRY!

        if confirmed:
            if email == join_invitation.contact.email:
                new_user = self.create_user()
                join_invitation.accept(
                    new_user
                )  # should go before creation of EmailAddress below
                if request:
                    messages.add_message(
                        request, messages.INFO,
                        ugettext(
                            u"Your e-mail address has already been verified"))
                # already verified so can just create
                EmailAddress(user=new_user,
                             email=email,
                             verified=True,
                             primary=True).save()
            else:
                new_user = self.create_user()
                join_invitation.accept(
                    new_user
                )  # should go before creation of EmailAddress below
                if email:
                    if request:
                        messages.add_message(
                            request, messages.INFO,
                            ugettext(u"Confirmation e-mail sent to %(email)s")
                            % {
                                "email": email,
                            })
                    EmailAddress.objects.add_email(new_user, email)
        else:
            new_user = self.create_user()
            send_email_confirmation(new_user, request=request)

        super(SignupForm, self).save(new_user)
        self.after_signup(new_user)

        return new_user
コード例 #5
0
ファイル: views.py プロジェクト: RamonPage/pythoncampus
def create(request):
    form = SubscriptionForm(request.POST)
    context = {
        'MEDIA_URL': settings.MEDIA_URL,
        'form': form
    }
    try:
        subscription = form.save_if_new()
        send_email_confirmation(subscription)
    except ValueError:
        return render_to_response('subscription/form.html', context)
    return render_to_response('subscription/signed.html', context)
コード例 #6
0
ファイル: forms.py プロジェクト: GVRV/django-allauth
    def save(self, request=None):
        # don't assume a username is available. it is a common removal if
        # site developer wants to use e-mail authentication.
        email = self.cleaned_data["email"]
        
        if self.cleaned_data.get("confirmation_key"):
            from friends.models import JoinInvitation # @@@ temporary fix for issue 93
            try:
                join_invitation = JoinInvitation.objects.get(confirmation_key=self.cleaned_data["confirmation_key"])
                confirmed = True
            except JoinInvitation.DoesNotExist:
                confirmed = False
        else:
            confirmed = False
        
        new_user = self.create_user()
        super(SignupForm, self).save(new_user)

        # @@@ clean up some of the repetition below -- DRY!
        if confirmed:
            if email == join_invitation.contact.email:
                join_invitation.accept(new_user) # should go before creation of EmailAddress below
                if request:
                    messages.add_message(request, messages.INFO,
                        ugettext(u"Your e-mail address has already been verified")
                    )
                # already verified so can just create
                EmailAddress(user=new_user, email=email, verified=True, primary=True).save()
            else:
                join_invitation.accept(new_user) # should go before creation of EmailAddress below
                if email:
                    if request:
                        messages.add_message(request, messages.INFO,
                            ugettext(u"Confirmation e-mail sent to %(email)s") % {
                                "email": email,
                            }
                        )
                    EmailAddress.objects.add_email(new_user, email)
        elif not app_settings.USE_EMAIL_VERIFICATION:
            # If we're completely ignoring the email verification, just add email address 
            # record. 
            EmailAddress(user=new_user, email=email, verified=True, primary=True).save()
        else:
            send_email_confirmation(request, new_user)

        self.after_signup(new_user)
        
        return new_user
コード例 #7
0
ファイル: decorators.py プロジェクト: timgarbos/unicorn7
 def _wrapped_view(request, *args, **kwargs):
     if not EmailAddress.objects.filter(user=request.user,
                                        verified=True).exists():
         send_email_confirmation(request, request.user)
         return render(request, 'account/verified_email_required.html')
     return view_func(request, *args, **kwargs)