Differentiate between users and AS upon reg

This commit is contained in:
Andrew Morgan 2018-07-26 15:18:22 +01:00
parent 53a726fab1
commit 04733b1360

View file

@ -485,6 +485,17 @@ func Register(
}
}
// Application services can register users with no auth type, but require
// access token. Differentiate from users who are initially hitting register
// without an auth type
if r.Auth.Type == "" && req.URL.Query().Get("access_token") == "" {
return util.JSONResponse{
Code: http.StatusUnauthorized,
JSON: newUserInteractiveResponse(sessionID,
cfg.Derived.Registration.Flows, cfg.Derived.Registration.Params),
}
}
logger := util.GetLogger(req.Context())
logger.WithFields(log.Fields{
"username": r.Username,