def POST(self): name = self.get("name", None) email = self.get("email", None) message_type = self.get("message_type", None) note = self.get("note", None) company = self.get("company", None) feeling = self.get("feeling", None) if not name or not email or not message_type or not note or not company: self.redirect("/contact?error=1") if not validate_captcha(self): self.redirect("/contact?error=2") mail.send( config.emails.get('contact', '*****@*****.**'), "Contact Us - %s" % name, "misc/user_contact_us.tmpl", dict( name = name, email = email, message_type = message_type, note = note, company = company, feeling = feeling, user_agent = self.request.headers['User-Agent'], ip_address = self.request.remote_ip ) ) return self.render()
def POST(self, domain_name): self.page['captcha'] = get_captcha() domain = models.Domain.get(domain_name) email = self.get("email", None) errors = [] if not email: errors.append("Please provide an email address.") else: try: V.Email().to_python(email) except: errors.append("Please provide a valid email address.") if not validate_captcha(self): errors.append("The verification code was invalid.") if errors: self.page["domain,"] = domain self.page["email"] = email self.page["errors"] = errors return self.render() user = models.User.get(email, create=True) if user.is_subscribed(domain): subscribed = True else: subscribed = False user.subscribe(domain) # notify them for confirmation mail.send( email, "Confirm Subscription", "email/subscription_confirmation.tmpl", { "domain_name": domain_name, "to_address": email, "from_address": config.mail['from_address'], "subscribe_url": domain.get_subscribe_url(user), "site_url":site_url }, images=[ ['snapshot', domain.get_thumbnail_url(confirm=True)] ] ) self.template = "subscription_notification_sent" self.page["subscribed"] = subscribed self.page["domain"] = domain self.page["email"] = email return self.render()
def POST(self, why): self.page['captcha'] = get_captcha() errors = [] self.page["errors"] = errors domain_name = self.get("domain_name", None) firstname = self.get("firstname", None) lastname = self.get("lastname", None) company = self.get("company", None) title = self.get("title", None) reason = self.get("reason", None) note = self.get("note", None) if not domain_name or not firstname or not lastname or not company or not title or not reason or not note: errors.append("Please fill all the required fields.") elif not validate_captcha(self): errors.append("The verification code was invalid.") if not errors: domain = models.Domain.get(domain_name) if not domain: errors.append("We are not monitoring this domain.") elif domain.opted_out: errors.append("Domain has already been opted out.") if not errors: mail.send( config.emails["optout"], "Opt Out for %s" % domain_name, "email/user_opt_out.tmpl", dict( domain_name = domain_name, firstname = firstname, lastname = lastname, note = note, company = company, reason = reason, title = title, user_agent = self.request.headers['User-Agent'], ip_address = self.request.remote_ip ) ) self.session.optout_domain = domain_name self.session.optout_step = self.step+1 self.redirect('/optout/method') return self.render()
def GET(self, code): domain_name = None domain = None try: user, domain = models.user_domain_from_code(code) user.confirm_subscription(domain) # how to unsubscribe longest_downtime, average_downtime = domain.longest_average_downtime_in_past_30_days mail.send( user.email_address, "How to Unsubscribe", "email/subscription_complete.tmpl", { "domain_name": domain.name, "to_address": user.email_address, "from_address": config.mail['from_address'], "unsubscribe_url": domain.get_unsubscribe_url(user), "site_url": site_url, "num_of_outages": domain.num_outages_in_past_30_days, "longest_outage": "%0.1f" % longest_downtime, "average_downtime": "%0.1f" % average_downtime, "diff": domain.num_outages_in_past_30_days_difference_from_average, "month": utils.past_30_days_text(), }, images=[ ['snapshot', domain.get_thumbnail_url(confirm=True)] ] ) self.page["errors"] = [] except: self.page["errors"] = [True] self.page["domain,"] = domain self.page["breadcrumbs"] = [ urls["home"], urls["signup"], ] return self.render()
def POST(self, domain_name): domain = models.Domain.get(domain_name) errors = [] self.page['errors'] = errors if not validate_captcha(self): errors.append("The verification code was invalid.") if not errors: for contact in set(domain.whois_contacts): mail.send( contact, "Request for Monitoring for %s" % domain_name, "email/notify_admin.tmpl", { "config": config, "domain": self.domain, } ) self.session.cant_monitor_domain_name = None self.redirect('/') return self.render()
def GET(self, code=None): errors = [] self.page["errors"] = errors self.page["whois"] = False self.page["hide_buttons"] = False # if they've come from the email link, they go through this if code is not None: self.domain = models.domain_from_optout_code(code) if self.domain.opted_out: errors.append("Domain has already been opted out.") self.page["domain,"] = self.domain self.page["hide_buttons"] = True return self.render() self.session.optout_domain = self.domain.name self.next_step() option = self.session.optout_method if option == "contact_whois": self.page["whois"] = True selected_contact = self.session.optout_contact if not selected_contact: errors.append("Please select a contact first.") elif not selected_contact in self.domain.whois_contacts: errors.append("The selected contacts is not valid.") else: has_thumbnail = True #self.domain.has_thumbnail # why is this here? site_url = '' #================== mail.send( selected_contact, "Opt Out Confirmation", "email/optout_whois.tmpl", { "domain_name": self.domain.name, "whois_optout_url": self.domain.whois_optout_url, "whois_optout_code": self.domain.whois_optout_code, "site_url": site_url, "has_thumbnail": has_thumbnail }, images=[ ['snapshot', self.domain.get_thumbnail_url(confirm=True)] ] if has_thumbnail else [] ) return self.render() elif option == "create_dns": if self.dns_confirm(): self.next_step() else: errors.append("""We were not able to verify the DNS addition. Click try again after 15 minutes to check again.""") elif option == "publish_content": status, errmsg = self.publish_confirm() if status: self.next_step() else: errors.append(errmsg) if not errors: self.next_step() return self.render()