mirror of https://github.com/zulip/zulip.git
Move enterprise-registration to zilencer/ from zerver/
(imported from commit d8a58913040376dbdbc9dcee13ab8a7910733da7)
This commit is contained in:
parent
fce97df972
commit
53c76aa657
|
@ -11,7 +11,7 @@
|
|||
<br />
|
||||
|
||||
<form method="post" class="form-horizontal" id="registration"
|
||||
action="{% url 'zerver.views.enterprise_registration' %}">
|
||||
action="{% url 'zilencer.views.enterprise_registration' %}">
|
||||
{% csrf_token %}
|
||||
<div class="control-group">
|
||||
<label for="id_full_name" class="control-label">Name</label>
|
|
@ -50,11 +50,6 @@ class ToSForm(forms.Form):
|
|||
full_name = forms.CharField(max_length=100)
|
||||
terms = forms.BooleanField(required=True)
|
||||
|
||||
class EnterpriseToSForm(forms.Form):
|
||||
full_name = forms.CharField(max_length=100)
|
||||
company = forms.CharField(max_length=100)
|
||||
terms = forms.BooleanField(required=True)
|
||||
|
||||
class HomepageForm(forms.Form):
|
||||
# This form is important because it determines whether users can
|
||||
# register for our product. Be careful when modifying the
|
||||
|
|
|
@ -43,7 +43,7 @@ from zerver.lib.actions import bulk_remove_subscriptions, \
|
|||
from zerver.lib.create_user import random_api_key
|
||||
from zerver.lib.push_notifications import num_push_devices_for_user
|
||||
from zerver.forms import RegistrationForm, HomepageForm, ToSForm, \
|
||||
EnterpriseToSForm, CreateBotForm, is_inactive
|
||||
CreateBotForm, is_inactive
|
||||
from django.views.decorators.csrf import csrf_exempt, csrf_protect
|
||||
from django_openid_auth.views import default_render_failure, login_complete
|
||||
from openid.consumer.consumer import SUCCESS as openid_SUCCESS
|
||||
|
@ -373,25 +373,6 @@ def accounts_accept_terms(request):
|
|||
{ 'form': form, 'company_name': domain, 'email': email },
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def enterprise_registration(request):
|
||||
if request.method == "POST":
|
||||
form = EnterpriseToSForm(request.POST)
|
||||
if form.is_valid():
|
||||
company = form.cleaned_data["company"]
|
||||
name = form.cleaned_data["full_name"]
|
||||
subject = "Enterprise terms acceptance for " + company
|
||||
body = loader.render_to_string(
|
||||
"zerver/enterprise_tos_accept_body.txt",
|
||||
{"name": name, "company": company})
|
||||
send_mail(subject, body, settings.EMAIL_HOST_USER,
|
||||
["support@zulip.com"])
|
||||
return redirect("https://zulip.com/enterprise/download")
|
||||
else:
|
||||
form = EnterpriseToSForm()
|
||||
return render_to_response(
|
||||
"zerver/enterprise-registration.html", {"form": form},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
from zerver.lib.ccache import make_ccache
|
||||
|
||||
@authenticated_json_view
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
from django import forms
|
||||
|
||||
class EnterpriseToSForm(forms.Form):
|
||||
full_name = forms.CharField(max_length=100)
|
||||
company = forms.CharField(max_length=100)
|
||||
terms = forms.BooleanField(required=True)
|
|
@ -6,4 +6,8 @@ urlpatterns = patterns('zilencer.views',
|
|||
# and then redirects the user to the proper deployment
|
||||
# SSO-login page
|
||||
url(r'^accounts/deployment_dispatch$', 'account_deployment_dispatch', {'template_name': 'zerver/login.html'}),
|
||||
|
||||
# Enterprise terms registration, which redirects to a password-protected
|
||||
# software download page.
|
||||
url(r'^enterprise-registration/$', 'enterprise_registration'),
|
||||
)
|
||||
|
|
|
@ -2,6 +2,8 @@ from django.http import HttpResponse
|
|||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.views import login as django_login_page
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, redirect
|
||||
from django.template import RequestContext, loader
|
||||
|
||||
from zerver.decorator import has_request_variables, REQ, json_to_dict
|
||||
from zerver.lib.actions import internal_send_message
|
||||
|
@ -9,7 +11,10 @@ from zerver.lib.response import json_success, json_error, json_response, json_me
|
|||
from zerver.lib.rest import rest_dispatch as _rest_dispatch
|
||||
from zerver.models import get_realm, get_user_profile_by_email, email_to_domain, \
|
||||
UserProfile
|
||||
from zilencer.forms import EnterpriseToSForm
|
||||
from error_notify import notify_server_error, notify_browser_error
|
||||
from django.core.mail import send_mail
|
||||
from django.conf import settings
|
||||
|
||||
rest_dispatch = csrf_exempt((lambda request, *args, **kwargs: _rest_dispatch(request, globals(), *args, **kwargs)))
|
||||
|
||||
|
@ -95,3 +100,22 @@ def account_deployment_dispatch(request, **kwargs):
|
|||
template_response.context_data['desktop_sso_dispatch'] = True
|
||||
template_response.context_data['desktop_sso_unknown_email'] = sso_unknown_email
|
||||
return template_response
|
||||
|
||||
def enterprise_registration(request):
|
||||
if request.method == "POST":
|
||||
form = EnterpriseToSForm(request.POST)
|
||||
if form.is_valid():
|
||||
company = form.cleaned_data["company"]
|
||||
name = form.cleaned_data["full_name"]
|
||||
subject = "Enterprise terms acceptance for " + company
|
||||
body = loader.render_to_string(
|
||||
"zilencer/enterprise_tos_accept_body.txt",
|
||||
{"name": name, "company": company})
|
||||
send_mail(subject, body, settings.EMAIL_HOST_USER,
|
||||
["support@zulip.com"])
|
||||
return redirect("https://zulip.com/enterprise/download")
|
||||
else:
|
||||
form = EnterpriseToSForm()
|
||||
return render_to_response(
|
||||
"zilencer/enterprise-registration.html", {"form": form},
|
||||
context_instance=RequestContext(request))
|
||||
|
|
|
@ -72,10 +72,6 @@ urlpatterns = patterns('',
|
|||
url(r'^terms-enterprise/$', TemplateView.as_view(template_name='zerver/terms-enterprise.html')),
|
||||
url(r'^privacy/$', TemplateView.as_view(template_name='zerver/privacy.html')),
|
||||
|
||||
# Enterprise terms registration, which redirects to a password-protected
|
||||
# software download page.
|
||||
url(r'^enterprise-registration/$', 'zerver.views.enterprise_registration'),
|
||||
|
||||
# Login/registration
|
||||
url(r'^register/$', 'zerver.views.accounts_home', name='register'),
|
||||
url(r'^login/$', 'zerver.views.login_page', {'template_name': 'zerver/login.html'}),
|
||||
|
|
Loading…
Reference in New Issue