def login(request): if request.method == 'POST': form = AuthenticationForm(data=request.POST) if form.is_valid(): return render(request, 'registration/sent_mail.html') return django_login(request, authentication_form=AuthenticationForm)
def login(request): if request.method == 'POST': form = AuthenticationForm(data=request.POST) if form.is_valid(): code = LoginCode.objects.filter(**{'user__%s' % USERNAME_FIELD: request.POST.get('username')})[0] code.next = request.GET.get('next') code.save() code.send_login_email() return render(request, 'registration/sent_mail.html') return django_login(request, authentication_form=AuthenticationForm)
def post(self, request, *args, **kwargs): form = AuthenticationForm(data=request.POST) if form.is_valid(): code = LoginCode.objects.filter(**{'user__%s' % USERNAME_FIELD: request.POST.get('username')})[0] code.next = '/rsvp/rsvp-step2/' code.save() code.send_login_email() email = form.cleaned_data['username'] return render(request, 'email-on-the-way.html', { 'guest_email': email, }) else: return super(RsvpStartView, self).form_invalid(form)