Compare commits

..

No commits in common. "77d728a1531dc70a5161ec8542475d14ae2961f9" and "4e3977edd2cdd7ee1cb4bf356854b78ab5381e92" have entirely different histories.

3 changed files with 4 additions and 14 deletions

View File

@ -9,4 +9,4 @@ VENV=/town/venvs/ttadmin
source $VENV/bin/activate source $VENV/bin/activate
export DJANGO_SETTINGS_MODULE=settings_live export DJANGO_SETTINGS_MODULE=settings_live
cd $APP_ROOT cd $APP_ROOT
gunicorn -t120 -b0.0.0.0:$PORT ttadmin.wsgi gunicorn -b0.0.0.0:$PORT ttadmin.wsgi

View File

@ -1,5 +1,3 @@
import re
from django.shortcuts import redirect from django.shortcuts import redirect
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
@ -7,8 +5,6 @@ from django.views.generic.edit import FormView
from .forms import GuestbookForm from .forms import GuestbookForm
from .models import GuestbookMessage from .models import GuestbookMessage
SUSPICIOUS_RE = re.compile(r'https?://')
class GuestbookView(FormView): class GuestbookView(FormView):
form_class = GuestbookForm form_class = GuestbookForm
@ -21,7 +17,5 @@ class GuestbookView(FormView):
def form_valid(self, form): def form_valid(self, form):
del form.cleaned_data['captcha'] del form.cleaned_data['captcha']
if SUSPICIOUS_RE.search(form.cleaned_data['msg']) != None:
return redirect('guestbook:guestbook')
t = GuestbookMessage.objects.create(**form.cleaned_data) t = GuestbookMessage.objects.create(**form.cleaned_data)
return redirect('guestbook:guestbook') return redirect('guestbook:guestbook')

View File

@ -246,13 +246,9 @@ def on_townie_pre_save(sender, instance, **kwargs):
# See if we need to create the user on disk. # See if we need to create the user on disk.
if existing.unreviewed and instance.accepted: if existing.unreviewed and instance.accepted:
logger.info('Creating user {} on disk.'.format(instance.username)) logger.info('Creating user {} on disk.'.format(instance.username))
try:
instance.create_on_disk() instance.create_on_disk()
instance.write_authorized_keys()
except Exception as e:
logger.error('Failed syncing user {} to disk: {}'.format(instance.username, e)
else:
instance.send_welcome_email() instance.send_welcome_email()
instance.write_authorized_keys()
return return
else: else:
# This user state transition is currently undefined. In the future, we can check for things # This user state transition is currently undefined. In the future, we can check for things