mirror of https://github.com/zulip/zulip.git
Send you a registration email if you try to sign up for an existing realm.
(imported from commit 9104096b424f31a22ee7c8b72378f05309bb978b)
This commit is contained in:
parent
7c788c1a17
commit
1c5110dbad
|
@ -40,7 +40,12 @@ $(function () {
|
||||||
$("#success").show();
|
$("#success").show();
|
||||||
},
|
},
|
||||||
error: function (xhr, error_type, xhn) {
|
error: function (xhr, error_type, xhn) {
|
||||||
$("#error").show();
|
if (xhr.status === 403) {
|
||||||
|
// You tried signing up with a domain that already uses Zulip!
|
||||||
|
$("#group-already-uses-zulip").show();
|
||||||
|
} else {
|
||||||
|
$("#error").show();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
complete: function (xhr, statusText) {
|
complete: function (xhr, statusText) {
|
||||||
$("#beta-signup").removeAttr('disabled').text("Sign up");
|
$("#beta-signup").removeAttr('disabled').text("Sign up");
|
||||||
|
|
|
@ -28,6 +28,15 @@
|
||||||
While you wait, check out some of our <a href="/features">features</a>!
|
While you wait, check out some of our <a href="/features">features</a>!
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="group-already-uses-zulip" class="alert alert-hidden alert-success alert-block">
|
||||||
|
<p>Good news: your group already uses Zulip! We've sent you an
|
||||||
|
email with the steps to complete your registration.</p>
|
||||||
|
|
||||||
|
<p>(If you want to create a new group instead of joining this one,
|
||||||
|
please contact <a href="mailto:support@zulip.com">support@zulip.com</a> and we'll
|
||||||
|
get you set up)</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="error" class="alert alert-hidden alert-error alert-block">
|
<div id="error" class="alert alert-hidden alert-error alert-block">
|
||||||
<h4>Ruh-roh!</h4>
|
<h4>Ruh-roh!</h4>
|
||||||
Hmmm, something went wrong. Please send email to <a href="mailto:support@zulip.com">support@zulip.com</a>.
|
Hmmm, something went wrong. Please send email to <a href="mailto:support@zulip.com">support@zulip.com</a>.
|
||||||
|
|
|
@ -201,17 +201,32 @@ def principal_to_user_profile(agent, principal):
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def beta_signup_submission(request, name=REQ, email=REQ,
|
def beta_signup_submission(request, name=REQ, email=REQ,
|
||||||
company=REQ, count=REQ, product=REQ):
|
company=REQ, count=REQ, product=REQ):
|
||||||
|
|
||||||
|
domain = resolve_email_to_domain(email)
|
||||||
|
realm = get_realm(domain)
|
||||||
|
|
||||||
content = """Name: %s
|
content = """Name: %s
|
||||||
Email: %s
|
Email: %s
|
||||||
Company: %s
|
Company: %s
|
||||||
# users: %s
|
# users: %s
|
||||||
Currently using: %s""" % (name, email, company, count, product,)
|
Currently using: %s""" % (name, email, company, count, product,)
|
||||||
|
|
||||||
subject = "Interest in Zulip: %s" % (company,)
|
subject = "Interest in Zulip: %s" % (company,)
|
||||||
|
if realm:
|
||||||
|
subject = "(Realm already exists) " + subject
|
||||||
|
|
||||||
from_email = '"%s" <zulip+signups@zulip.com>' % (name,)
|
from_email = '"%s" <zulip+signups@zulip.com>' % (name,)
|
||||||
to_email = '"Zulip Signups" <zulip+signups@zulip.com>'
|
to_email = '"Zulip Signups" <zulip+signups@zulip.com>'
|
||||||
headers = {'Reply-To' : '"%s" <%s>' % (name, email,)}
|
headers = {'Reply-To' : '"%s" <%s>' % (name, email,)}
|
||||||
msg = EmailMessage(subject, content, from_email, [to_email], headers=headers)
|
msg = EmailMessage(subject, content, from_email, [to_email], headers=headers)
|
||||||
msg.send()
|
msg.send()
|
||||||
|
|
||||||
|
if realm:
|
||||||
|
# This domain already uses Zulip, so they probably meant to
|
||||||
|
# register. Send them a registration link.
|
||||||
|
send_registration_completion_email(email, request)
|
||||||
|
return json_error("Your group is already signed up!", status=403)
|
||||||
|
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|
||||||
@require_post
|
@require_post
|
||||||
|
@ -698,16 +713,23 @@ def accounts_home_with_domain(request, domain):
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect(reverse('zerver.views.accounts_home'))
|
return HttpResponseRedirect(reverse('zerver.views.accounts_home'))
|
||||||
|
|
||||||
|
def send_registration_completion_email(email, request):
|
||||||
|
"""
|
||||||
|
Send an email with a confirmation link to the provided e-mail so the user
|
||||||
|
can complete their registration.
|
||||||
|
"""
|
||||||
|
prereg_user = create_preregistration_user(email, request)
|
||||||
|
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||||
|
'enterprise': settings.ENTERPRISE}
|
||||||
|
Confirmation.objects.send_confirmation(prereg_user, email,
|
||||||
|
additional_context=context)
|
||||||
|
|
||||||
def accounts_home(request):
|
def accounts_home(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = create_homepage_form(request, user_info=request.POST)
|
form = create_homepage_form(request, user_info=request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
email = form.cleaned_data['email']
|
email = form.cleaned_data['email']
|
||||||
prereg_user = create_preregistration_user(email, request)
|
send_registration_completion_email(email, request)
|
||||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
|
||||||
'enterprise': settings.ENTERPRISE}
|
|
||||||
Confirmation.objects.send_confirmation(prereg_user, email,
|
|
||||||
additional_context=context)
|
|
||||||
return HttpResponseRedirect(reverse('send_confirm', kwargs={'email': email}))
|
return HttpResponseRedirect(reverse('send_confirm', kwargs={'email': email}))
|
||||||
try:
|
try:
|
||||||
email = request.POST['email']
|
email = request.POST['email']
|
||||||
|
|
Loading…
Reference in New Issue