diff --git a/app/views/account/SubscriptionView.coffee b/app/views/account/SubscriptionView.coffee index de796e5e2..41ace9c30 100644 --- a/app/views/account/SubscriptionView.coffee +++ b/app/views/account/SubscriptionView.coffee @@ -89,7 +89,7 @@ module.exports = class SubscriptionView extends RootView onClickRecipientsSubscribe: (e) -> emails = @$el.find('.recipient-emails').val().split('\n') valid = @emailValidator.validateEmails(emails, =>@render?()) - @recipientSubs.startSubscribe(emails) if valid + @recipientSubs.startSubscribe(emails) if valid onClickRecipientUnsubscribe: (e) -> $(e.target).addClass('hide') @@ -108,8 +108,8 @@ class EmailValidator validateEmails: (emails, render) -> @lastEmails = emails.join('\n') - #taken from http://www.regular-expressions.info/email.html - emailRegex = /[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,4}/ + #taken from http://www.regular-expressions.info/email.html + emailRegex = /[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,63}/ @validEmails = (email for email in emails when emailRegex.test(email.trim().toLowerCase())) return @emailsInvalid(render) if @validEmails.length < emails.length return @emailsValid(render) diff --git a/app/views/core/AuthModal.coffee b/app/views/core/AuthModal.coffee index 10494a36f..e7e73f0e7 100644 --- a/app/views/core/AuthModal.coffee +++ b/app/views/core/AuthModal.coffee @@ -79,7 +79,7 @@ module.exports = class AuthModal extends ModalView emailCheck: -> email = $('#email', @$el).val() - filter = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i # https://news.ycombinator.com/item?id=5763990 + filter = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i # https://news.ycombinator.com/item?id=5763990 unless filter.test(email) forms.setErrorToProperty @$el, 'email', 'Please enter a valid email address', true return false diff --git a/app/views/courses/StudentSignUpModal.coffee b/app/views/courses/StudentSignUpModal.coffee index 5e4ec404c..3b7c03e12 100644 --- a/app/views/courses/StudentSignUpModal.coffee +++ b/app/views/courses/StudentSignUpModal.coffee @@ -37,7 +37,7 @@ module.exports = class StudentSignUpModal extends ModalView emailCheck: -> email = @$('#email').val() - filter = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i # https://news.ycombinator.com/item?id=5763990 + filter = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i # https://news.ycombinator.com/item?id=5763990 unless filter.test(email) @$('#errors-alert').text($.i18n.t('share_progress_modal.email_invalid')).removeClass('hide') return false