Require email activation before posting snipts. Effing spammers.

master
Nick Sergeant 2016-05-10 11:35:51 -04:00
commit 68e2d4dd8b
7 arquivos alterados com 20 adições e 11 exclusões

Ver arquivo

@ -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'

Ver arquivo

@ -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 %}

Ver arquivo

@ -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)

Ver arquivo

@ -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>

Ver arquivo

@ -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

Ver arquivo

@ -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')),

Ver arquivo

@ -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