added code to prevent user self-registration
This commit is contained in:
parent
4d4defc416
commit
4abc7bf81e
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue