mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05:00
✨ Improve email clean mechanism
This commit is contained in:
parent
c975e0bcee
commit
16fa0b0330
2 changed files with 12 additions and 0 deletions
|
@ -46,6 +46,10 @@
|
|||
(let [email (str/lower email)
|
||||
email (if (str/starts-with? email "mailto:")
|
||||
(subs email 7)
|
||||
email)
|
||||
email (if (or (str/starts-with? email "<")
|
||||
(str/ends-with? email ">"))
|
||||
(str/trim email "<>")
|
||||
email)]
|
||||
email))
|
||||
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
(t/use-fixtures :once th/state-init)
|
||||
(t/use-fixtures :each th/database-reset)
|
||||
|
||||
|
||||
(t/deftest clean-email
|
||||
(t/is "foo@example.com" (profile/clean-email "mailto:foo@example.com"))
|
||||
(t/is "foo@example.com" (profile/clean-email "mailto:<foo@example.com>"))
|
||||
(t/is "foo@example.com" (profile/clean-email "<foo@example.com>"))
|
||||
(t/is "foo@example.com" (profile/clean-email "foo@example.com>"))
|
||||
(t/is "foo@example.com" (profile/clean-email "<foo@example.com")))
|
||||
|
||||
;; Test with wrong credentials
|
||||
(t/deftest profile-login-failed-1
|
||||
(let [profile (th/create-profile* 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue