Commit 0460a4bd authored by stef's avatar stef
Browse files

[enh] confirmation/activation/moderation urls now display in proper design, not bare html

parent 9a4de038
...@@ -51,7 +51,8 @@ def activate(request): ...@@ -51,7 +51,8 @@ def activate(request):
try: try:
v=Violation.objects.get(activationid=request.GET.get('key','asdf')) v=Violation.objects.get(activationid=request.GET.get('key','asdf'))
except: except:
return HttpResponse(_('Thank you, this key has been already activated')) messages.add_message(request, messages.INFO, unicode(_('Thank you, this key has been already activated')))
return HttpResponseRedirect('/') # Redirect after POST
if v: if v:
actid = hashlib.sha1(''.join([chr(randint(32, 122)) for x in range(12)])).hexdigest() actid = hashlib.sha1(''.join([chr(randint(32, 122)) for x in range(12)])).hexdigest()
to=[x.email for x in User.objects.filter(groups__name='moderator')] to=[x.email for x in User.objects.filter(groups__name='moderator')]
...@@ -73,7 +74,8 @@ def moderate(request): ...@@ -73,7 +74,8 @@ def moderate(request):
try: try:
v=Violation.objects.get(activationid=request.GET.get('key','asdf')) v=Violation.objects.get(activationid=request.GET.get('key','asdf'))
except: except:
return HttpResponse(_('Thank you, this key has been already activated')) messages.add_message(request, messages.INFO, unicode(_('Thank you, this key has been already activated')))
return HttpResponseRedirect('/') # Redirect after POST
if not v: if not v:
messages.add_message(request, messages.INFO, _('No such key')) messages.add_message(request, messages.INFO, _('No such key'))
return HttpResponseRedirect('/') # Redirect after POST return HttpResponseRedirect('/') # Redirect after POST
...@@ -109,13 +111,16 @@ def confirm(request, id, name=None): ...@@ -109,13 +111,16 @@ def confirm(request, id, name=None):
try: try:
c=Confirmation(key=actid, email=name, violation=Violation.objects.get(pk=id)) c=Confirmation(key=actid, email=name, violation=Violation.objects.get(pk=id))
except: except:
return HttpResponse(unicode(_("Thank you, this has been already confirmed"))) messages.add_message(request, messages.INFO, unicode(_('Thank you, this has been already confirmed')))
return HttpResponseRedirect('/') # Redirect after POST
c.save() c.save()
return HttpResponse('<div class="confirm_thanks">%s</div>' % unicode(_('Thank you for your confirmation')) ) messages.add_message(request, messages.INFO, unicode(_('Thank you for your confirmation')))
return HttpResponseRedirect('/') # Redirect after POST
try: try:
c = get_object_or_404(Confirmation, key=id) c = get_object_or_404(Confirmation, key=id)
except: except:
return HttpResponse(unicode(_("Thank you, this has been already confirmed"))) messages.add_message(request, messages.INFO, unicode(_("Thank you, this has been already confirmed")))
return HttpResponseRedirect('/') # Redirect after POST
c.key='' c.key=''
c.save() c.save()
messages.add_message(request, messages.INFO, unicode(_('Thank you for verifying your confirmation'))) messages.add_message(request, messages.INFO, unicode(_('Thank you for verifying your confirmation')))
...@@ -173,7 +178,7 @@ def add(request): ...@@ -173,7 +178,7 @@ def add(request):
a.storage.save(sname,f) a.storage.save(sname,f)
a.save() a.save()
messages.add_message(request, messages.INFO, _('Thank you for submitting this report, you will receive a verification email shortly.')) messages.add_message(request, messages.INFO, _('Thank you for submitting this report, you will receive a verification email immediately, if not check your spam folder.'))
return HttpResponseRedirect('/') # Redirect after POST return HttpResponseRedirect('/') # Redirect after POST
else: else:
form = AddViolation() form = AddViolation()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment