From 4abc7bf81e61e94e42654f02290a7b0adbb87e24 Mon Sep 17 00:00:00 2001 From: Brad Date: Mon, 9 Jun 2014 14:32:00 -0700 Subject: [PATCH] added code to prevent user self-registration --- server/handler/login.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/handler/login.go b/server/handler/login.go index f769e5fc..640a6443 100644 --- a/server/handler/login.go +++ b/server/handler/login.go @@ -49,6 +49,12 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error { // get the user from the database u, err := h.users.FindLogin(host, login.Login) if err != nil { + // if self-registration is disabled we should + // return a notAuthorized error + if !h.conf.Registration { + return notAuthorized{} + } + // create the user account u = user.New(remote.GetName(), login.Login, login.Email) u.Name = login.Name