mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-18 07:02:22 -05:00
97c145433e
Also changed EmailHelper to use the regexp already used in UserRegistrationHandler rather than the `mimelib` package as it is deprecated.
12 lines
392 B
CoffeeScript
12 lines
392 B
CoffeeScript
EMAIL_REGEXP = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA -Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
|
|
module.exports = EmailHelper =
|
|
|
|
parseEmail: (email) ->
|
|
return null unless email?
|
|
email = email.trim().toLowerCase()
|
|
|
|
matched = email.match EMAIL_REGEXP
|
|
return null unless matched? && matched[0]?
|
|
|
|
matched[0]
|