🎉 Add registration domain whitelist for emails

Signed-off-by: Andrey Miskov <amiskov@gmail.com>
This commit is contained in:
Andrey Miskov 2020-03-16 18:55:44 +03:00 committed by Andrey Antukh
parent 394d238f97
commit c663d54eb8
4 changed files with 26 additions and 0 deletions

View file

@ -18,6 +18,7 @@
[uxbox.db :as db]
[uxbox.services.mutations :as sm]
[uxbox.services.queries :as sq]
[uxbox.services.mutations.profile :as profile]
[uxbox.tests.helpers :as th]))
(t/use-fixtures :once th/state-init)
@ -191,6 +192,15 @@
(t/is (= 0 (count (:result out))))))
))
(t/deftest registration-domain-whitelist
(let [whitelist "gmail.com, hey.com, ya.ru"]
(t/testing "allowed email domain"
(t/is (true? (profile/email-domain-in-whitelist? whitelist "username@ya.ru")))
(t/is (true? (profile/email-domain-in-whitelist? "" "username@somedomain.com"))))
(t/testing "not allowed email domain"
(t/is (false? (profile/email-domain-in-whitelist? whitelist "username@somedomain.com"))))))
;; TODO: profile deletion with teams
;; TODO: profile deletion with owner teams
;; TODO: profile registration