mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Client-side email validation should allow capital letters
This commit is contained in:
parent
f00006ee7d
commit
941820ac88
2 changed files with 9 additions and 1 deletions
|
@ -46,7 +46,7 @@ Discourse.Utilities =
|
|||
|
||||
emailValid: (email)->
|
||||
# see: http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
|
||||
re = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/
|
||||
re = /^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/
|
||||
re.test(email)
|
||||
|
||||
selectedText: ->
|
||||
|
|
|
@ -80,3 +80,11 @@ describe "Discourse.Utilities", ->
|
|||
|
||||
it "works with links that have underscores in them", ->
|
||||
expect(cook("http://en.wikipedia.org/wiki/Homicide:_Life_on_the_Street")).toBe("<p><a href=\"http://en.wikipedia.org/wiki/Homicide:_Life_on_the_Street\" class=\"onebox\" target=\"_blank\">http://en.wikipedia.org/wiki/Homicide:_Life_on_the_Street</a></p>")
|
||||
|
||||
describe "emailValid", ->
|
||||
|
||||
it "allows upper case in first part of emails", ->
|
||||
expect(Discourse.Utilities.emailValid('Bob@example.com')).toBe(true)
|
||||
|
||||
it "allows upper case in domain of emails", ->
|
||||
expect(Discourse.Utilities.emailValid('bob@EXAMPLE.com')).toBe(true)
|
||||
|
|
Loading…
Reference in a new issue