From 4642ba07b6b9b26f22085bdbe4a908ad3f3e9e77 Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Mon, 21 Mar 2016 14:48:44 -0400 Subject: [PATCH] Make Snipt free for all. --- accounts/models.py | 9 -- accounts/templates/account.html | 3 - accounts/urls.py | 4 - accounts/views.py | 65 +------- blogs/middleware.py | 1 - .../templates/blogs/themes/default/base.html | 12 +- media/css/style.scss | 5 - media/js/src/account.js | 19 --- media/js/src/application.js | 14 -- media/js/src/modules/partials/billing.html | 54 ------- media/js/src/modules/partials/blogging.html | 5 +- media/js/src/modules/site.js | 80 ---------- media/js/src/modules/snipt.js | 13 +- snipts/api.py | 9 -- .../snipts/snipt-edit-js-template.html | 3 - .../templates/snipts/snipt-js-template.html | 2 - snipts/templates/snipts/snipt-list.html | 2 - teams/templates/teams/for-teams-complete.html | 5 +- teams/templates/teams/for-teams.html | 87 ----------- teams/templates/teams/team-billing.html | 66 -------- teams/templates/teams/team-members.html | 5 - teams/urls.py | 8 +- teams/views.py | 91 ----------- templates/base.html | 25 +-- templates/homepage.html | 24 +-- templates/pro-complete.html | 31 ---- templates/pro.html | 146 ------------------ templates/profile.html | 4 - templates/registration/registration_form.html | 5 +- urls.py | 7 +- views.py | 57 ------- 31 files changed, 21 insertions(+), 840 deletions(-) delete mode 100644 media/js/src/modules/partials/billing.html delete mode 100644 teams/templates/teams/team-billing.html delete mode 100644 templates/pro-complete.html delete mode 100644 templates/pro.html diff --git a/accounts/models.py b/accounts/models.py index 1c242e6..5839803 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -137,13 +137,4 @@ class UserProfile(models.Model): self.user.date_joined.replace(tzinfo=None) return delta.days - @property - def has_pro(self): - if (self.is_pro or - self.has_teams or - self.is_a_team): - return True - else: - return False - User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0]) diff --git a/accounts/templates/account.html b/accounts/templates/account.html index 5dbab94..79ccfff 100644 --- a/accounts/templates/account.html +++ b/accounts/templates/account.html @@ -26,9 +26,6 @@
  • Editor
  • -
  • - Billing -
  • diff --git a/accounts/urls.py b/accounts/urls.py index f457ecb..1fcae22 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -4,8 +4,4 @@ from django.conf.urls import * urlpatterns = \ patterns('', url(r'^stats/$', views.stats, name='account-stats'), - url(r'^cancel-subscription/$', views.cancel_subscription, - name='cancel-subscription'), - url(r'^stripe-account-details/$', views.stripe_account_details, - name='stripe-account-details'), url(r'^', views.account, name='account-detail')) diff --git a/accounts/views.py b/accounts/views.py index 3446670..ef5fc85 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,10 +1,5 @@ -import os -import stripe - -from annoying.decorators import ajax_request, render_to -from django.conf import settings +from annoying.decorators import render_to from django.contrib.auth.decorators import login_required -from django.core.mail import send_mail from snipts.models import Snipt @@ -14,64 +9,6 @@ def account(request): return {} -@login_required -@ajax_request -def cancel_subscription(request): - - if request.user.profile.stripe_id is None: - return {} - else: - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - customer = stripe.Customer.retrieve(request.user.profile.stripe_id) - customer.delete() - - profile = request.user.profile - profile.is_pro = False - profile.stripe_id = None - profile.save() - - send_mail('[Snipt] User cancelled Pro: {}'.format(request.user.username), - """ - User: https://snipt.net/{} - Email: {} - """.format(request.user.username, request.user.email), - 'support@snipt.net', - ['nick@snipt.net'], - fail_silently=False) - - return {'deleted': True} - - -@login_required -@ajax_request -def stripe_account_details(request): - - if request.user.profile.stripe_id is None: - return {} - else: - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - customer = stripe.Customer.retrieve(request.user.profile.stripe_id) - - data = { - 'last4': customer.active_card.last4, - 'created': customer.created, - 'email': customer.email, - } - - if customer.subscription: - data['amount'] = customer.subscription.plan.amount - data['interval'] = customer.subscription.plan.interval - data['name'] = customer.subscription.plan.name - data['status'] = customer.subscription.status - data['nextBill'] = customer.subscription.current_period_end - else: - data['status'] = 'inactive' - - return data - - @login_required @render_to('stats.html') def stats(request): diff --git a/blogs/middleware.py b/blogs/middleware.py index f630740..644032c 100644 --- a/blogs/middleware.py +++ b/blogs/middleware.py @@ -34,7 +34,6 @@ class BlogMiddleware: get_object_or_404(User, username__iexact=blog_user) if request.blog_user is None: - # TODO: This needs to check profile.has_pro() instead. pro_users = User.objects.filter(userprofile__is_pro=True) for pro_user in pro_users: diff --git a/blogs/templates/blogs/themes/default/base.html b/blogs/templates/blogs/themes/default/base.html index 8e348af..f1ee54e 100644 --- a/blogs/templates/blogs/themes/default/base.html +++ b/blogs/templates/blogs/themes/default/base.html @@ -77,12 +77,10 @@ {% endif %} - {% if not blog_user.profile.has_pro %} - - {% endif %} + {% endblock %} diff --git a/media/css/style.scss b/media/css/style.scss index 99ef60f..4f7ac6a 100644 --- a/media/css/style.scss +++ b/media/css/style.scss @@ -311,11 +311,6 @@ header.main { min-width: 100px; padding-bottom: 7px; text-transform: uppercase; - - span.is-pro { - color: #3299B7; - font-style: italic; - } } } &:hover { diff --git a/media/js/src/account.js b/media/js/src/account.js index e05a325..3b35b3b 100644 --- a/media/js/src/account.js +++ b/media/js/src/account.js @@ -15,10 +15,6 @@ if (typeof angular !== 'undefined') { templateUrl: '/static/js/src/modules/partials/profile.html', controller: controllers.ProfileController }); - $routeProvider.when('/account/billing/', { - templateUrl: '/static/js/src/modules/partials/billing.html', - controller: controllers.BillingController - }); $routeProvider.when('/account/blogging/', { templateUrl: '/static/js/src/modules/partials/blogging.html', controller: controllers.BloggingController @@ -63,15 +59,6 @@ if (typeof angular !== 'undefined') { return promise; }, - getStripeAccount: function() { - - var promise = $http({ - method: 'GET', - url: '/account/stripe-account-details/' - }); - - return promise; - }, saveAccount: function(user, fields) { var promise = $http({ @@ -173,12 +160,6 @@ if (typeof angular !== 'undefined') { AccountStorage.getAccount().then(function(response) { $scope.user = response.data; - - if ($scope.user.has_pro && $scope.user.stripe_id && $scope.user.stripe_id !== 'COMP') { - AccountStorage.getStripeAccount().then(function(response) { - $scope.user.stripeAccount = response.data; - }); - } }); $scope.saveFields = function(fields) { diff --git a/media/js/src/application.js b/media/js/src/application.js index 88ada6d..101e18a 100644 --- a/media/js/src/application.js +++ b/media/js/src/application.js @@ -23,14 +23,6 @@ jQuery(function($) { var pre = $pres.eq(i); pre.width(pre.parents('section.code').width() - 30); }); - - $('form#cancel-team-subscription').submit(function() { - if (confirm('Are you sure you want to cancel your subscription?\n\nYou will no longer be able to create new Snipts under this team. This action is effective immediately and we unfortunately cannot issue any refunds.')) { - return true; - } else { - return false; - } - }); }); // Angular app init. @@ -55,12 +47,6 @@ jQuery(function($) { if (root.location.pathname === '/account/stats/') { root.ll('tagEvent', 'Viewed stats page'); } - if (root.location.pathname === '/pro/') { - root.ll('tagEvent', 'Viewed Pro page'); - } - if (root.location.pathname === '/pro/signup/') { - root.ll('tagEvent', 'Viewed Pro signup page'); - } } app.controller('AppController', function($scope) { diff --git a/media/js/src/modules/partials/billing.html b/media/js/src/modules/partials/billing.html deleted file mode 100644 index 96adbed..0000000 --- a/media/js/src/modules/partials/billing.html +++ /dev/null @@ -1,54 +0,0 @@ -
    -
    -

    - Sit tight, we're cancelling your subscription... -

    -
    -
    -

    - You have successfully cancelled your subscription.
    You will no longer be billed. -

    -

    - We're very sorry to see you go. Mind dropping us a quick email to support@snipt.net - to let us know why you cancelled? We'd really appreciate it. -

    -
    -
    -
    -
    -

    - You're not a Pro yet, so we have nothing to show you here.
    -
    Signup for Pro » -

    -
    -
    -
    - {[{ user.stripeAccount.name || 'Loading...' }]} -
    -
    - One-time payment -
    -
    - ${[{ user.stripeAccount.amount / 100 }]}.00 USD / {[{ user.stripeAccount.interval }]} - Loading... -
    -
    - xxxx-xxxx-xxxx-{[{ user.stripeAccount.last4 || 'Loading...' }]} - Loading... -
    -
    - {[{ user.stripeAccount.status || 'Loading...' }]} -
    -
    - {[{ user.stripeAccount.created * 1000 |date:'fullDate' }]} - Loading... -
    -
    - {[{ user.stripeAccount.nextBill * 1000 |date:'fullDate' }]} - Loading... -
    -

    - Cancel subscription -

    -
    -
    diff --git a/media/js/src/modules/partials/blogging.html b/media/js/src/modules/partials/blogging.html index 78e7d31..d35b214 100644 --- a/media/js/src/modules/partials/blogging.html +++ b/media/js/src/modules/partials/blogging.html @@ -17,9 +17,8 @@
    - - Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME to `snipt.net` or A-record to `96.126.110.160`. You can use multiple domains here: separate each domain with a space. The first domain will be your primary domain. All other domains will redirect to your primary domain. - Go Pro to enable a custom domain for your Snipt blog. + + Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME to `snipt.net` or A-record to `96.126.110.160`. You can use multiple domains here: separate each domain with a space. The first domain will be your primary domain. All other domains will redirect to your primary domain.
    diff --git a/media/js/src/modules/site.js b/media/js/src/modules/site.js index 9f30229..075cec3 100644 --- a/media/js/src/modules/site.js +++ b/media/js/src/modules/site.js @@ -96,62 +96,6 @@ window.ui_halted = false; }); - if (this.$body.hasClass('pro-signup')) { - var $form = $('form#pro-signup'); - var $submit = $('button[type="submit"]', $form); - - var $cardNumber = $('input#number'); - var $expMonth = $('select#exp-month'); - var $expYear = $('select#exp-year'); - var $cvc = $('input#cvc'); - - $form.submit(function() { - - $submit.attr('disabled', 'disabled'); - - var errors = false; - - if (!Stripe.validateCardNumber($cardNumber.val())) { - $cardNumber.parents('div.control-group').addClass('error'); - errors = true; - } else { - $cardNumber.parents('div.control-group').removeClass('error'); - } - - if (!Stripe.validateExpiry($expMonth.val(), $expYear.val())) { - $expMonth.parents('div.control-group').addClass('error'); - errors = true; - } else { - $expMonth.parents('div.control-group').removeClass('error'); - } - - if (!Stripe.validateCVC($cvc.val())) { - $cvc.parents('div.control-group').addClass('error'); - errors = true; - } else { - $cvc.parents('div.control-group').removeClass('error'); - } - - if (!errors) { - - $('.payment-errors').hide(); - $('.payment-loading').show(); - - Stripe.createToken({ - number: $cardNumber.val(), - cvc: $cvc.val(), - exp_month: $expMonth.val(), - exp_year: $expYear.val() - }, that.stripeResponseHandler); - - } else { - $submit.removeAttr('disabled'); - } - - return false; - }); - } - if (this.$body.hasClass('login')) { $('input#id_username').focus(); } @@ -248,30 +192,6 @@ $('div.infield label', this.$body).inFieldLabels({ fadeDuration: 200 }); - }, - stripeResponseHandler: function(status, response) { - - var $form = $('form#pro-signup'); - - if (response.error) { - $('button[type="submit"]', $form).removeAttr('disabled'); - $('.payment-loading').hide(); - $('.payment-errors').text(response.error.message).show(); - } else { - var token = response.id; - - // Kill all of the form details so none of it touches our server. - // Note, this is unnecessary, because the inputs themselves do not - // have a name attr, meaning they'll never get sent to begin with. - $('input#name').val(''); - $('input#number').val(''); - $('select#exp-month').val(''); - $('select#exp-year').val(''); - $('input#cvc').val(''); - - $form.append(""); - $form.get(0).submit(); - } } }); diff --git a/media/js/src/modules/snipt.js b/media/js/src/modules/snipt.js index 7aa1dd3..70524b3 100644 --- a/media/js/src/modules/snipt.js +++ b/media/js/src/modules/snipt.js @@ -132,13 +132,10 @@ var $checkbox = $(this); var $label = $checkbox.parent(); - $('div.alert-not-pro').hide(); if ($checkbox.is(':checked')) { $label.removeClass('is-private').addClass('is-public'); - if (!window.user_has_pro) $('div.alert-not-pro').hide(); } else { $label.addClass('is-private').removeClass('is-public'); - if (!window.user_has_pro) $('div.alert-not-pro').show(); } return false; }).change(); @@ -664,8 +661,6 @@ }; } - var has_pro = $user.siblings('span.pro').length ? true : false; - var data = { code: $('textarea.raw', $el).text(), description: $('textarea.description', $el).text(), @@ -691,9 +686,7 @@ user: { absolute_url: $user.attr('href'), username: $user.text(), - profile: { - has_pro: has_pro - } + profile: {} } }; @@ -729,9 +722,7 @@ public: true, user: { username: '', - profile: { - has_pro: window.user_has_pro - } + profile: {} } }; diff --git a/snipts/api.py b/snipts/api.py index edc4667..bf591b5 100644 --- a/snipts/api.py +++ b/snipts/api.py @@ -153,13 +153,6 @@ class SniptValidation(Validation): if (len(bundle.data['title']) > 255): errors['title-length'] = ("Title must be 255 characters or less.") - if request.user.profile.has_pro is False: - if ('public' not in bundle.data or bundle.data['public'] is False): - errors['not-pro'] = ("You'll need to go Pro " - "(https://snipt.net/pro/) " - "in order to create private " - "snipts.") - return errors @@ -310,7 +303,6 @@ class PrivateUserProfileResource(ModelResource): bundle.data['username'] = bundle.obj.user.username bundle.data['user_id'] = bundle.obj.user.id bundle.data['api_key'] = bundle.obj.user.api_key.key - bundle.data['has_pro'] = bundle.obj.user.profile.has_pro return bundle @@ -335,7 +327,6 @@ class PrivateUserResource(ModelResource): bundle.data['email_md5'] = hashlib \ .md5(bundle.obj.email.lower().encode('utf-8')) \ .hexdigest() - bundle.data['has_pro'] = bundle.obj.profile.has_pro bundle.data['stats'] = { 'public_snipts': Snipt.objects.filter(user=bundle.obj.id, public=True).count(), diff --git a/snipts/templates/snipts/snipt-edit-js-template.html b/snipts/templates/snipts/snipt-edit-js-template.html index 87094d2..0418449 100644 --- a/snipts/templates/snipts/snipt-edit-js-template.html +++ b/snipts/templates/snipts/snipt-edit-js-template.html @@ -20,9 +20,6 @@
    -

     

    diff --git a/snipts/templates/snipts/snipt-js-template.html b/snipts/templates/snipts/snipt-js-template.html index 31f5a89..25942f6 100644 --- a/snipts/templates/snipts/snipt-js-template.html +++ b/snipts/templates/snipts/snipt-js-template.html @@ -74,8 +74,6 @@ <% if (window.teams.indexOf(snipt.user.username) !== -1) { %> Team - <% } else if (window.user_has_pro) { %> - Pro <% } %> <% if (!snipt.new_from_js) { %> diff --git a/snipts/templates/snipts/snipt-list.html b/snipts/templates/snipts/snipt-list.html index eebc46a..c92bf09 100644 --- a/snipts/templates/snipts/snipt-list.html +++ b/snipts/templates/snipts/snipt-list.html @@ -183,8 +183,6 @@ {{ snipt.user.username }} {% if snipt.user.profile.is_a_team %} Team - {% elif snipt.user.profile.has_pro %} - Pro {% endif %} {% if snipt.user.profile.gittip_username %} Tip diff --git a/teams/templates/teams/for-teams-complete.html b/teams/templates/teams/for-teams-complete.html index b7e3817..c7a7753 100644 --- a/teams/templates/teams/for-teams-complete.html +++ b/teams/templates/teams/for-teams-complete.html @@ -10,7 +10,7 @@ {% endblock %} {% block content %} -
    +
    Team created successfully. @@ -22,9 +22,6 @@
  • Add some members
  • -
  • - View billing info -
  • diff --git a/teams/templates/teams/for-teams.html b/teams/templates/teams/for-teams.html index 3b1e58a..15354c0 100644 --- a/teams/templates/teams/for-teams.html +++ b/teams/templates/teams/for-teams.html @@ -4,17 +4,8 @@ {% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %} -{% block extra-scripts %} - -{% endblock %} - {% block js %} {{ block.super }} - {% if debug %} - Stripe.setPublishableKey('pk_test_cgknmaWRMQeJt2adEdvH3T9l'); - {% else %} - Stripe.setPublishableKey('pk_live_gUO2nCl7dhx6j0posz6gnbhA'); - {% endif %} {% endblock %} {% block breadcrumb %} @@ -36,8 +27,6 @@
  • Members can create and edit public and private snippets on a team.
  • Detailed log of changes on a snippet, including user and code diffs.
  • Maintain a public team profile by posting public snippets.
  • -
  • All team members are automatically granted personal Pro accounts.
  • -
  • Plans from $24/month, each with a 14-day free trial.
  • {% if not request.user.is_authenticated %} @@ -48,8 +37,6 @@
    {% else %}
    -
    Please wait…
    -
    @@ -68,84 +55,10 @@

    -
    - -
    - -

    - Free 14-day trial (your card won't be charged until then, and you can cancel at any time). -

    -
    -
    -
    - -
    - - Visa - MasterCard - Discover - American Express -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    {% csrf_token %} -
    - Secure by default. Every Snipt page is secure. -
    -
    - Your credit card is stored securely with Stripe and we use Stripe.js for maximum security. -
    {% endif %} diff --git a/teams/templates/teams/team-billing.html b/teams/templates/teams/team-billing.html deleted file mode 100644 index cfb5b21..0000000 --- a/teams/templates/teams/team-billing.html +++ /dev/null @@ -1,66 +0,0 @@ -{% extends "base.html" %} - -{% load team_tags %} - -{% block page-title %}Team Billing{% endblock %} - -{% block body-class %}account {{ block.super }}{% endblock %} - -{% block breadcrumb %} -
  • {{ team.user.username }}
  • - /
  • Billing
  • -{% endblock %} - -{% block content %} -
    -
    - -
    -
    - {{ name }} -
    - {% if status != 'inactive' and status != 'promo' %} -
    - ${{ amount|currency_convert }}.00 USD / {{ interval }} -
    -
    - xxxx-xxxx-xxxx-{{ last4 }} -
    -
    - {{ status }} -
    -
    - {{ team.created|date:'M d, Y' }} -
    -
    - {{ nextBill|to_date|date:'M d, Y' }} -
    -
    - {% csrf_token %} - -
    - {% endif %} -
    -
    -{% endblock %} - -{% block analytics %} - {% if not debug %} - window.ll('tagScreen', 'Team billing view'); - {% endif %} -{% endblock %} diff --git a/teams/templates/teams/team-members.html b/teams/templates/teams/team-members.html index fb1d03f..de35ec4 100644 --- a/teams/templates/teams/team-members.html +++ b/teams/templates/teams/team-members.html @@ -24,11 +24,6 @@
  • Members
  • - {% if team.owner == request.user %} -
  • - Billing -
  • - {% endif %}
    diff --git a/teams/urls.py b/teams/urls.py index aa157e6..2038bef 100644 --- a/teams/urls.py +++ b/teams/urls.py @@ -14,10 +14,4 @@ urlpatterns = \ name='add-team-member'), url(r'^(?P[^/]+)/members/$', views.team_members, - name='team-members'), - url(r'^(?P[^/]+)/billing/$', - views.team_billing, - name='team-billing'), - url(r'^(?P[^/]+)/billing/cancel/$', - views.cancel_team_subscription, - name='team-cancel-subscription')) + name='team-members')) diff --git a/teams/views.py b/teams/views.py index 5bf49e6..ab8b4a0 100644 --- a/teams/views.py +++ b/teams/views.py @@ -1,5 +1,4 @@ import os -import stripe import uuid from annoying.decorators import render_to @@ -26,27 +25,9 @@ def for_teams(request): def for_teams_complete(request): if request.method == 'POST' and request.user.is_authenticated(): - token = request.POST['token'] - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - - plan = request.POST['plan'] - - try: - customer = stripe.Customer.create(card=token, - plan=plan, - email=request.user.email) - except stripe.CardError as e: - error_message = e.json_body['error']['message'] - return HttpResponseRedirect('/for-teams/?declined=%s' % - error_message or - 'Your card was declined.') - team = Team(name=request.POST['team-name'], email=request.POST['email'], - plan=plan, owner=request.user) - team.stripe_id = customer.id team.save() user = User.objects.create_user(team.slug, @@ -73,46 +54,6 @@ def for_teams_complete(request): return HttpResponseBadRequest() -@login_required -@render_to('teams/team-billing.html') -def team_billing(request, username): - team = get_object_or_404(Team, slug=username, disabled=False) - if team.owner != request.user: - raise Http404 - - if team.stripe_id == 'COMP': - return { - 'name': 'Promotional trial', - 'team': team, - 'status': 'promo' - } - - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - customer = stripe.Customer.retrieve(team.stripe_id) - - data = { - 'last4': customer.active_card.last4, - 'created': customer.created, - 'email': customer.email, - 'team': team - } - - if customer.subscription: - data['amount'] = customer.subscription.plan.amount - data['interval'] = customer.subscription.plan.interval - data['name'] = customer.subscription.plan.name - data['status'] = customer.subscription.status - data['nextBill'] = customer.subscription.current_period_end - else: - data['status'] = 'inactive' - - return data - return { - 'team': team - } - - @login_required @render_to('teams/team-members.html') def team_members(request, username): @@ -151,35 +92,3 @@ def remove_team_member(request, username, member): team.members.remove(user) return HttpResponseRedirect('/' + team.slug + '/members/') - - -@login_required -def cancel_team_subscription(request, username): - - if request.method != 'POST': - raise Http404 - - team = get_object_or_404(Team, slug=username, disabled=False) - if team.owner != request.user: - raise Http404 - - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - customer = stripe.Customer.retrieve(team.stripe_id) - customer.delete() - - team.disabled = True - team.stripe_id = None - team.plan = None - team.save() - - send_mail('[Snipt] Team cancelled plan: {}'.format(team.name), - """ - Team: https://snipt.net/{} - Email: {} - """.format(team.slug, team.email), - 'support@snipt.net', - ['nick@snipt.net'], - fail_silently=False) - - return HttpResponseRedirect('/' + team.slug + '/?team-cancelled=true') diff --git a/templates/base.html b/templates/base.html index 5aadb13..4058285 100644 --- a/templates/base.html +++ b/templates/base.html @@ -68,7 +68,7 @@ - + {% block header %}
    @@ -146,7 +146,7 @@ {% if request.user.profile.has_pro %} Pro {% else %} - Basic member + Snipt user {% endif %} @@ -170,14 +170,6 @@ Account - {% if not request.user.profile.has_pro %} -
  • - - - Go Pro - -
  • - {% endif %}
  • @@ -222,7 +214,7 @@ {% block aside %}
  • -
    -
    -
    -
    -

    See it in action

    -
    -
    -
    - -
    -
    - -
    {% endblock %} diff --git a/templates/pro-complete.html b/templates/pro-complete.html deleted file mode 100644 index 688923b..0000000 --- a/templates/pro-complete.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "base.html" %} - -{% block page-title %}Sign up for Snipt Pro{% endblock %} - -{% block body-class %}{{ block.super }} static pro signup pro-signup pro-signup-complete{% endblock %} - -{% block breadcrumb %} -
  • Snipt Pro
  • -
  • / Complete
  • -{% endblock %} - -{% block content %} -
    -
    -
    - You rock. -

    - You're now a Snipt Pro.

    - You should tell the world. - If you ever need anything at all, email support, or use the chat in the bottom right. -

    -
    -
    -
    -{% endblock %} - -{% block analytics %} - {% if not debug %} - window.ll('tagScreen', 'Pro signup complete view'); - {% endif %} -{% endblock %} diff --git a/templates/pro.html b/templates/pro.html deleted file mode 100644 index 3fc2ada..0000000 --- a/templates/pro.html +++ /dev/null @@ -1,146 +0,0 @@ -{% extends "base.html" %} - -{% block page-title %}Sign up for Snipt Pro{% endblock %} - -{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %} - -{% block extra-scripts %} - -{% endblock %} - -{% block js %} - {{ block.super }} - {% if debug %} - Stripe.setPublishableKey('pk_test_cgknmaWRMQeJt2adEdvH3T9l'); - {% else %} - Stripe.setPublishableKey('pk_live_gUO2nCl7dhx6j0posz6gnbhA'); - {% endif %} -{% endblock %} - -{% block breadcrumb %} -
  • Snipt Pro
  • -{% endblock %} - -{% block content %} - {% if request.GET.declined %} -
    - {{ request.GET.declined }} You have not been charged. Please try again. -
    - {% endif %} -
    -
    -
    - Go Pro for just $5/month. -

    - As a paid Snipt member you'll unlock the ability to post private snipts, - have unrestricted access to the app, API, - custom-domain blogging, instant chat support, and more. -

    -

    - Group discounts available. Email support@snipt.net for details. -

    -
    - {% if not request.user.is_authenticated %} - - {% elif request.user.profile.has_pro %} - - {% else %} -
    -
    Please wait…
    -
    -
    - -
    - -
    -
    -
    - -
    - - Visa - MasterCard - Discover - American Express -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    -
    - {% csrf_token %} - -
    - Secure by default. Every Snipt page is secure. -
    -
    - Your credit card is stored securely with Stripe and we use Stripe.js for maximum security. -
    -
    -
    - Prefer to pay with PayPal? Email support@snipt.net. -
    - {% endif %} -
    -
    -{% endblock %} - -{% block analytics %} - {% if not debug %} - window.ll('tagScreen', 'Pro signup view'); - {% endif %} -{% endblock %} diff --git a/templates/profile.html b/templates/profile.html index a28f0d0..5a861c3 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -45,7 +45,6 @@
    Team settings - Billing » Members »
    @@ -75,9 +74,6 @@ {% endif %} - {% if user.profile.has_pro %} - Pro - {% endif %} {% if user.profile.gittip_username %} Tip {% endif %} diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 89ee976..9d40b5d 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -21,10 +21,7 @@ {% endif %} {% endif %}
    -
    - Free to post public snipts,
    just $5/month for private snipts. -
    -
    +
    {{ form.username }} diff --git a/urls.py b/urls.py index ea757b6..a08a4c5 100644 --- a/urls.py +++ b/urls.py @@ -11,8 +11,8 @@ from snipts.api import (PublicSniptResource, from snipts.views import search from tastypie.api import Api from utils.views import SniptRegistrationView -from views import (homepage, lexers, login_redirect, pro, sitemap, tags, - pro_complete, user_api_key) +from views import (homepage, lexers, login_redirect, sitemap, tags, + user_api_key) public_api = Api(api_name='public') public_api.register(PublicSniptResource()) @@ -43,9 +43,6 @@ urlpatterns = \ url(r'^sitemap.xml$', sitemap), url(r'^tags/$', tags), - url(r'^pro/$', pro), - url(r'^pro/complete/$', pro_complete), - url(r'^account/', include('accounts.urls')), url(r'^api/public/lexer/$', lexers), diff --git a/views.py b/views.py index a539ae4..e821aa0 100644 --- a/views.py +++ b/views.py @@ -1,15 +1,9 @@ -import datetime import hashlib -import os -import stripe from accounts.models import UserProfile from annoying.decorators import ajax_request, render_to from blogs.views import blog_list -from django.conf import settings -from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User -from django.core.mail import send_mail from django.db.models import Count from django.http import HttpResponseRedirect, HttpResponseBadRequest from django.shortcuts import render_to_response @@ -84,57 +78,6 @@ def login_redirect(request): return HttpResponseRedirect('/') -@render_to('pro.html') -def pro(request): - return {} - - -@login_required -@render_to('pro-complete.html') -def pro_complete(request): - - if request.method == 'POST': - - token = request.POST['token'] - stripe.api_key = os.environ.get('STRIPE_SECRET_KEY', - settings.STRIPE_SECRET_KEY) - - if 'plan' in request.GET: - plan = request.GET['plan'] - else: - plan = request.POST['plan'] - - try: - customer = stripe.Customer.create(card=token, - plan=plan, - email=request.user.email) - except stripe.CardError as e: - error_message = e.json_body['error']['message'] - return HttpResponseRedirect('/pro/?declined=%s' % error_message or - 'Your card was declined.') - - profile = request.user.profile - profile.is_pro = True - profile.pro_date = datetime.datetime.now() - profile.stripe_id = customer.id - profile.save() - - send_mail('[Snipt] New Pro signup: {}'.format(request.user.username), - """ - User: https://snipt.net/{} - Email: {} - Plan: {} - """.format(request.user.username, request.user.email, plan), - 'support@snipt.net', - ['nick@snipt.net'], - fail_silently=False) - - return {} - - else: - return HttpResponseBadRequest() - - def sitemap(request): tags = Tag.objects.filter(snipt__public=True)