Require email activation before posting snipts. Effing spammers.

master
Nick Sergeant 2016-05-10 11:35:51 -04:00
rodič 8f59093aff
revize 68e2d4dd8b
7 změnil soubory, kde provedl 20 přidání a 11 odebrání

Zobrazit soubor

@ -29,7 +29,7 @@ if 'DATABASE_URL' in os.environ:
}
ABSOLUTE_URL_OVERRIDES = {'auth.user': lambda u: "/%s/" % u.username}
ACCOUNT_ACTIVATION_DAYS = 0
ACCOUNT_ACTIVATION_DAYS = 14
ADMINS = (('Nick Sergeant', 'nick@snipt.net'),)
ALLOWED_HOSTS = ['*']
AUTH_PROFILE_MODULE = 'accounts.UserProfile'

Zobrazit soubor

@ -26,7 +26,11 @@
{% include "snipts/snipt-list.html" %}
{% empty %}
<div class="empty-snipts">
No snipts to show here. Sorry!
{% if request.user == user and not request.user.is_active %}
Welcome! Please click the activation link in your email in order to create your first snipt.
{% else %}
No snipts to show here. Sorry!
{% endif %}
</div>
{% endfor %}
{% paginate %}

Zobrazit soubor

@ -22,9 +22,6 @@ def slugify_uniquely(value, model, slugfield="slug"):
def activate_user(user, request, **kwargs):
user.is_active = True
user.save()
user = authenticate(username=request.POST['username'],
password=request.POST['password1'])
login(request, user)

Zobrazit soubor

@ -1,8 +1,10 @@
<li class="add-snipt">
<button class="btn btn-info btn-large" id="add-snipt">
Add {% if request.user.username == 'blog' %}Post{% else %}Snipt{% endif %}
<i class="icon-search icon-plus icon-white"></i>
</button>
{% if request.user.is_active %}
<button class="btn btn-info btn-large" id="add-snipt">
Add {% if request.user.username == 'blog' %}Post{% else %}Snipt{% endif %}
<i class="icon-search icon-plus icon-white"></i>
</button>
{% endif %}
{% if request.user.profile.has_teams %}
<ul class="add-snipt-teams">
<li>

Zobrazit soubor

@ -2,6 +2,10 @@ Hey there,
Welcome to Snipt. If you ever have any thoughts or issues with the site whatsoever, please feel free to contact me directly.
To complete your registration, please activate your account here:
https://{{site.domain}}{% url 'registration_activate' activation_key %}
Thanks!
Nick Sergeant

Zobrazit soubor

@ -3,7 +3,7 @@ import os
from django.conf.urls import include, patterns, url
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.views.generic import TemplateView
from django.views.generic import RedirectView, TemplateView
from snipts.api import (PublicSniptResource,
PublicUserResource, PrivateSniptResource,
PrivateFavoriteResource, PrivateUserProfileResource,
@ -56,6 +56,8 @@ urlpatterns = \
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
url(r'^signup/$', SniptRegistrationView.as_view(),
name='registration_register'),
url(r'^activate/complete/$', RedirectView.as_view(
url='/login-redirect/')),
url(r'', include('registration.backends.default.urls')),
url(r'^', include('teams.urls')),

Zobrazit soubor

@ -2,7 +2,7 @@ import requests
from django.conf import settings
from django.http import HttpResponse
from registration.backends.default.views import RegistrationView
from registration.backends.default.views import ActivationView, RegistrationView
from utils.forms import SniptRegistrationForm