def signup_confirmed(request): """Simple view to show a message after the user successfully signs up.""" return message_page( request, u"Thank you for signing up! An email was " u"dispatched to your address. Please click the link inside to verify " u"your email and activate your account, which expires in 48 hours. " u"Please check your email's spam folder if it does not appear in the " u"inbox.", )
def contact(request): if request.method == "POST": contact_form = ContactForm(request.POST) if contact_form.is_valid(): send_mail( "Knight Book Market Support", "From: %s\nReason: %s\n\n%s" % (request.POST["email"], request.POST["reason"], request.POST["message"]), "settings.EMAIL_HOST_USER", ["*****@*****.**"], ) return message_page(request, u"Thanks for contacting us!") else: contact_form = ContactForm() return load_page(request, "contact-report.html", {"form": contact_form})
def resend_key(request, username): """View for resending an expired or lost authentication key.""" # Generate a new activation key for the user. user = get_object_or_404(User, username=username) profile = get_object_or_404(UserProfile, user=user) activation_key = generate_new_key(user) if profile.is_verified: return message_page(request, "Your user account is already activated!") # Send a new email with the confirmation link site = Site.objects.get(id=settings.SITE_ID) subject = "%s User Activation" % site.name body = ( "Hello, %s, and thanks for signing up for an account at %s!" "\n\nTo activate your account, click this link within 48 hours:" "\n\nhttp://%s/login/%s" % (user.username, site.domain, site.domain, activation_key) ) send_mail(subject, body, "settings.EMAIL_HOST_USER", [user.email]) return message_page(request, "A new link was sent to %s" % user.email)
def report(request, id=None): if request.method == "POST": report_form = ReportForm(request.POST) if report_form.is_valid(): try: sale = unicode(Sale.objects.get(id=id)) except: sale = "Not found." send_mail( "Knight Book Market Report", "From: %s\n" "Reason: %s\n" "Reported Sale: %s (ID: %s)\n\n" "%s" % (request.POST["email"], request.POST["reason"], sale, id, request.POST["message"]), "settings.EMAIL_HOST_USER", ["*****@*****.**"], ) return message_page(request, u"Thanks for contacting us!") else: report_form = ReportForm() return load_page(request, "contact-report.html", {"form": report_form, "report": True, "id": id})