mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Wrapping render_to_response never actually worked correctly. On the login page, mixpanel_token would be missing, but we wouldn't get an error because it is surrounded by double quotes, which meant that it was still valid Javascript. (imported from commit 820ee42fab8f679983e5a3a4309a2feaf690f20f)
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
|
|
|
__revision__ = '$Id: views.py 21 2008-12-05 09:21:03Z jarek.zgoda $'
|
|
|
|
|
|
from django.shortcuts import render_to_response
|
|
from django.template import RequestContext
|
|
from django.conf import settings
|
|
|
|
from confirmation.models import Confirmation
|
|
|
|
|
|
def confirm(request, confirmation_key):
|
|
confirmation_key = confirmation_key.lower()
|
|
obj = Confirmation.objects.confirm(confirmation_key)
|
|
confirmed = True
|
|
if not obj:
|
|
# confirmation failed
|
|
confirmed = False
|
|
try:
|
|
# try to get the object we was supposed to confirm
|
|
obj = Confirmation.objects.get(confirmation_key=confirmation_key)
|
|
except Confirmation.DoesNotExist:
|
|
pass
|
|
ctx = {
|
|
'object': obj,
|
|
'confirmed': confirmed,
|
|
'days': getattr(settings, 'EMAIL_CONFIRMATION_DAYS', 10),
|
|
'key': confirmation_key,
|
|
'gafyd_name': request.GET.get("gafyd_name", None),
|
|
}
|
|
templates = [
|
|
'confirmation/confirm.html',
|
|
]
|
|
if obj:
|
|
# if we have an object, we can use specific template
|
|
templates.insert(0, 'confirmation/confirm_%s.html' % obj._meta.module_name)
|
|
return render_to_response(templates, ctx,
|
|
context_instance=RequestContext(request))
|