urls: Separate endpoint for signup and new realm email confirm.

This is preparation for the next commit.
This commit is contained in:
Vishnu Ks
2018-08-24 08:01:42 +00:00
committed by Tim Abbott
parent c8fbc0706f
commit d2e4417a72
6 changed files with 14 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ casper.then(function () {
});
// Make sure confirmation email is send
this.waitWhileVisible('form[action^="/new/"]', function () {
var regex = new RegExp('^http://[^/]+/accounts/send_confirm/' + email);
var regex = new RegExp('^http://[^/]+/accounts/new/send_confirm/' + email);
this.test.assertUrlMatch(regex, 'Confirmation mail send');
});
});

View File

@@ -108,7 +108,7 @@ def write_log_line(log_data: MutableMapping[str, Any], path: str, method: str, r
# because someone manually entered a nonexistent path), as UTF-8 chars make
# statsd sad when it sends the key name over the socket
statsd_path = statsd_path.encode('ascii', errors='ignore').decode("ascii")
blacklisted_requests = ['do_confirm', 'send_confirm',
blacklisted_requests = ['do_confirm', 'signup_send_confirm', 'new_realm_send_confirm,'
'eventslast_event_id', 'webreq.content', 'avatar', 'user_uploads',
'password.reset', 'static', 'json.bots', 'json.users', 'json.streams',
'accounts.unsubscribe', 'apple-touch-icon', 'emoji', 'json.bots',

View File

@@ -235,7 +235,7 @@ class TestGenerateRealmCreationLink(ZulipTestCase):
result = self.client_post(generated_link, {'email': email})
self.assertEqual(result.status_code, 302)
self.assertTrue(re.search('/accounts/send_confirm/{}$'.format(email),
self.assertTrue(re.search('/accounts/new/send_confirm/{}$'.format(email),
result["Location"]))
result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started", result)

View File

@@ -397,6 +397,9 @@ class PasswordResetTest(ZulipTestCase):
result = self.client_get('/accounts/send_confirm/alice@example.com')
self.assert_in_success_response(["Still no email?"], result)
result = self.client_get('/accounts/new/send_confirm/alice@example.com')
self.assert_in_success_response(["Still no email?"], result)
class LoginTest(ZulipTestCase):
"""
Logging in, registration, and logging out.
@@ -1577,7 +1580,7 @@ class RealmCreationTest(ZulipTestCase):
result = self.client_post('/new/', {'email': email})
self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(
"/accounts/send_confirm/%s" % (email,)))
"/accounts/new/send_confirm/%s" % (email,)))
result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result)
@@ -1652,7 +1655,7 @@ class RealmCreationTest(ZulipTestCase):
result = self.client_post('/new/', {'email': email})
self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(
"/accounts/send_confirm/%s" % (email,)))
"/accounts/new/send_confirm/%s" % (email,)))
result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result)

View File

@@ -405,7 +405,7 @@ def create_realm(request: HttpRequest, creation_key: Optional[str]=None) -> Http
if key_record is not None:
key_record.delete()
return HttpResponseRedirect(reverse('send_confirm', kwargs={'email': email}))
return HttpResponseRedirect(reverse('new_realm_send_confirm', kwargs={'email': email}))
else:
form = RealmCreationForm()
return render(request,
@@ -444,7 +444,7 @@ def accounts_home(request: HttpRequest, multiuse_object: Optional[MultiuseInvite
logging.error('Error in accounts_home: %s' % (str(e),))
return HttpResponseRedirect("/config-error/smtp")
return HttpResponseRedirect(reverse('send_confirm', kwargs={'email': email}))
return HttpResponseRedirect(reverse('signup_send_confirm', kwargs={'email': email}))
email = request.POST['email']
try:

View File

@@ -425,7 +425,10 @@ i18n_urls = [
name='zerver.views.registration.accounts_home'),
url(r'^accounts/send_confirm/(?P<email>[\S]+)?',
TemplateView.as_view(template_name='zerver/accounts_send_confirm.html'),
name='send_confirm'),
name='signup_send_confirm'),
url(r'^accounts/new/send_confirm/(?P<email>[\S]+)?',
TemplateView.as_view(template_name='zerver/accounts_send_confirm.html'),
name='new_realm_send_confirm'),
url(r'^accounts/register/', zerver.views.registration.accounts_register,
name='zerver.views.registration.accounts_register'),
url(r'^accounts/do_confirm/(?P<confirmation_key>[\w]+)',