mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Allow up to 63-character-long TLDs in email addresses
This commit is contained in:
parent
c36bed8103
commit
6d6f6138b1
3 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue