Permalink
Browse files

Cleanup auth stuff.

  • Loading branch information...
nicksergeant committed Nov 4, 2016
1 parent 7168a72 commit 2c33e68874cb51af78f6be810c074b734ccc13d6
Showing with 32 additions and 83 deletions.
  1. +0 βˆ’44 accounts/templates/activate.html
  2. +0 βˆ’2 accounts/urls.py
  3. +0 βˆ’8 accounts/views.py
  4. +32 βˆ’29 urls.py
@@ -1,44 +0,0 @@
-{% load static %}
-
-{% extends "base.html" %}
-
-{% block page-title %}Activate account{% endblock %}
-
-{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %}
-
-{% block breadcrumb %}
- <li><a href="/account/activate/">Activate</a></li>
-{% endblock %}
-
-{% block content %}
- {% if request.GET.declined %}
- <div class="alert alert-error" style="margin: 30px;">
- <strong>{{ request.GET.declined }}</strong> You have not been charged. Please try again.
- </div>
- {% endif %}
- <form class="form-horizontal static-box" id="pro-signup" method="post" action="/account/activate/">
- <fieldset>
- <div class="info">
- Activate for a one-time fee of <span>$5</span>.<br />
- <small style="font-size: 14px; color: #C0C0C0;">Fully refundable within 3 days of signup. All ads removed for paid accounts.</small>
- </div>
- <div class="payment-form">
- <div class="payment-errors alert alert-error"></div>
- <script
- src="https://checkout.stripe.com/checkout.js"
- class="stripe-button"
- data-email="{{ request.user.email }}"
- data-key="{% if debug %}pk_test_cgknmaWRMQeJt2adEdvH3T9l{% else %}pk_live_gUO2nCl7dhx6j0posz6gnbhA{% endif %}"
- data-image="{{ STATIC_URL }}img/avatar.png"
- data-name="Snipt"
- data-description="Full Snipt.net Account ($5.00)"
- data-amount="500">
- </script>
- {% csrf_token %}
- </div>
- <div class="form-actions" style="color: #A2A2A2;">
- Prefer to pay with PayPal? Email <a href="mailto:support@snipt.net">support@snipt.net</a>.
- </div>
- </fieldset>
- </form>
-{% endblock %}
View
@@ -3,8 +3,6 @@
urlpatterns = [
- url(r'^activate/$', views.activate,
- name='account-activate'),
url(r'^stats/$', views.stats, name='account-stats'),
url(r'^', views.account, name='account-detail')
]
View
@@ -10,14 +10,6 @@ def account(request):
return {}
-@login_required
-@render_to('activate.html')
-def activate(request):
- request.user.is_active = True
- request.user.save()
- return HttpResponseRedirect('/login-redirect/')
-
-
@login_required
@render_to('stats.html')
def stats(request):
View
61 urls.py
@@ -4,15 +4,14 @@
from django.contrib import admin
from django.contrib.auth.views import login
from django.http import HttpResponseRedirect
-from django.views.generic import RedirectView, TemplateView
+from django.views.generic import TemplateView
from django.views.static import serve
from snipts.api import (PublicSniptResource,
PublicUserResource, PrivateSniptResource,
PrivateFavoriteResource, PrivateUserProfileResource,
PrivateUserResource, PublicTagResource)
from snipts.views import search
from tastypie.api import Api
-from utils.views import SniptRegistrationView
from views import (homepage, lexers, login_redirect,
tags, user_api_key)
@@ -29,35 +28,39 @@
urlpatterns = []
-if os.environ.get("DISABLE_SIGNUP") != "true":
+if os.environ.get("DISABLE_SIGNUP") == "true":
urlpatterns += [
- url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
- url(r'^signup/$', SniptRegistrationView.as_view(), name='registration_register'),
- url(r'', include('registration.backends.simple.urls')),
+ url(r'^register/?$', lambda x: HttpResponseRedirect('/404/')),
+ url(r'^signup/?$', lambda x: HttpResponseRedirect('/404/')),
]
+else:
+ urlpatterns += [
+ url(r'^signup/?$', lambda x: HttpResponseRedirect('/register/')),
+ ]
+
urlpatterns += [
- url(r'^$', homepage),
- url(r'^login-redirect/$', login_redirect),
- url(r'^admin/', include(admin.site.urls)),
- url(r'^404/$', TemplateView.as_view(template_name='404.html')),
- url(r'^500/$', TemplateView.as_view(template_name='500.html')),
- url(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt')),
- url(r'^tags/$', tags),
- url(r'^account/', include('accounts.urls')),
- url(r'^api/public/lexer/$', lexers),
- url(r'^api/private/key/$', user_api_key),
- url(r'^api/', include(public_api.urls)),
- url(r'^api/', include(private_api.urls)),
- url(r'^search/$', search),
- url(r'^activate/complete/$', RedirectView.as_view( url='/login-redirect/')),
- url(r'^login/?$', login, name='login'),
- url(r'^', include('teams.urls')),
- url(r'^', include('snipts.urls')),
- url(r'^(?P<path>favicon\.ico)$', serve, {
- 'document_root': os.path.join(os.path.dirname(__file__), 'static/img')
- }),
- url(r'^static/(?P<path>.*)$', serve, {
- 'document_root': os.path.join(os.path.dirname(__file__), 'media')
- })
+ url(r'^$', homepage),
+ url(r'', include('registration.backends.simple.urls')),
+ url(r'^login/?$', login, name='login'),
+ url(r'^login-redirect/$', login_redirect),
+ url(r'^admin/', include(admin.site.urls)),
+ url(r'^404/$', TemplateView.as_view(template_name='404.html')),
+ url(r'^500/$', TemplateView.as_view(template_name='500.html')),
+ url(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt')),
+ url(r'^tags/$', tags),
+ url(r'^account/', include('accounts.urls')),
+ url(r'^api/public/lexer/$', lexers),
+ url(r'^api/private/key/$', user_api_key),
+ url(r'^api/', include(public_api.urls)),
+ url(r'^api/', include(private_api.urls)),
+ url(r'^search/$', search),
+ url(r'^', include('teams.urls')),
+ url(r'^', include('snipts.urls')),
+ url(r'^(?P<path>favicon\.ico)$', serve, {
+ 'document_root': os.path.join(os.path.dirname(__file__), 'static/img')
+ }),
+ url(r'^static/(?P<path>.*)$', serve, {
+ 'document_root': os.path.join(os.path.dirname(__file__), 'media')
+ })
]

0 comments on commit 2c33e68

Please sign in to comment.