summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
authorRaphaƫl Bournhonesque <raphael0202@users.noreply.github.com>2016-11-14 13:36:59 +0100
committerenahum <nahumhbl@gmail.com>2016-11-14 09:36:59 -0300
commit602f85d2efe6b9127c0cd79618757c3ff2b0ef5b (patch)
tree99376615f5054f65be461130415858d838fbca2a /api/user.go
parentef080a0a10e58e46a1f65e3dd352234e7ccd5aa9 (diff)
downloadchat-602f85d2efe6b9127c0cd79618757c3ff2b0ef5b.tar.gz
chat-602f85d2efe6b9127c0cd79618757c3ff2b0ef5b.tar.bz2
chat-602f85d2efe6b9127c0cd79618757c3ff2b0ef5b.zip
Increase unit test coverage of api/user.go (#4541)
* Add test to CheckUserDomain * Add unit test to IsUsernameTaken
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/user.go b/api/user.go
index 60c2673d9..93a07134d 100644
--- a/api/user.go
+++ b/api/user.go
@@ -192,6 +192,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
}
+// Check that a user's email domain matches a list of space-delimited domains as a string.
func CheckUserDomain(user *model.User, domains string) bool {
if len(domains) == 0 {
return true
@@ -1957,6 +1958,7 @@ func updateUserNotify(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+// Check if the username is already used by another user. Return false if the username is invalid.
func IsUsernameTaken(name string) bool {
if !model.IsValidUsername(name) {