signup: Remove old frontend validation of subdomain.

We make request to check availibity of subdomain which also checks the
subdomain for illegal characters.  Duplicating the backend logic in
frontend in this case is thus no longer necessary.
This commit is contained in:
Vishnu Ks 2018-01-25 23:39:16 +05:30 committed by Tim Abbott
parent d34dd4cd02
commit 6664c76a10
1 changed files with 0 additions and 31 deletions

View File

@ -208,37 +208,6 @@ if ($('.team_subdomain_error_server').text() === '') {
}
$("#timezone").val(moment.tz.guess());
$('#id_team_subdomain').on('input', function (e) {
// preserve selection range, to be set after setting the text
var start = e.target.selectionStart,
end = e.target.selectionEnd;
// toggle displaying server-side / client-side errors; messages
// from only one of the two should be showing at any time.
$('.team_subdomain_error_server').text('').css('display', 'none');
var autocorrected = e.target.value
.toLowerCase()
.replace(/[_|\s]/g, '-');
e.target.value = autocorrected;
if (e.target.value.charAt(0) === '-' ||
e.target.value.charAt(e.target.value.length - 1) === '-') {
$('#id_team_subdomain_error_client')
.text(i18n.t("Cannot start or end with a '-'"))
.css('display', 'block');
} else if (/[^0-9a-z\-]/.test(e.target.value)) {
$('#id_team_subdomain_error_client')
.text(i18n.t("Can only use letters a-z, numbers 0-9, and '-'s."))
.css('display', 'block');
} else {
$('#id_team_subdomain_error_client').text('').css('display', 'none');
}
e.target.setSelectionRange(start, end);
});
</script>
{% endblock %}