added code to prevent user self-registration

This commit is contained in:
Brad 2014-06-09 14:32:00 -07:00
parent 4d4defc416
commit 4abc7bf81e

View file

@ -49,6 +49,12 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
// get the user from the database // get the user from the database
u, err := h.users.FindLogin(host, login.Login) u, err := h.users.FindLogin(host, login.Login)
if err != nil { if err != nil {
// if self-registration is disabled we should
// return a notAuthorized error
if !h.conf.Registration {
return notAuthorized{}
}
// create the user account // create the user account
u = user.New(remote.GetName(), login.Login, login.Email) u = user.New(remote.GetName(), login.Login, login.Email)
u.Name = login.Name u.Name = login.Name