|
|
@ -325,7 +325,7 @@ func (app *appContext) NewUser(gc *gin.Context) {
|
|
|
|
app.debug.Printf("%s: New user attempt", req.Code)
|
|
|
|
app.debug.Printf("%s: New user attempt", req.Code)
|
|
|
|
if !app.checkInvite(req.Code, false, "") {
|
|
|
|
if !app.checkInvite(req.Code, false, "") {
|
|
|
|
app.info.Printf("%s New user failed: invalid code", req.Code)
|
|
|
|
app.info.Printf("%s New user failed: invalid code", req.Code)
|
|
|
|
respondBool(401, false, gc)
|
|
|
|
respond(401, "errorInvalidCode", gc)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
validation := app.validator.validate(req.Password)
|
|
|
|
validation := app.validator.validate(req.Password)
|
|
|
@ -344,15 +344,15 @@ func (app *appContext) NewUser(gc *gin.Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
existingUser, _, _ := app.jf.UserByName(req.Username, false)
|
|
|
|
existingUser, _, _ := app.jf.UserByName(req.Username, false)
|
|
|
|
if existingUser != nil {
|
|
|
|
if existingUser != nil {
|
|
|
|
msg := fmt.Sprintf("User already exists named %s", req.Username)
|
|
|
|
msg := fmt.Sprintf("User %s", req.Username)
|
|
|
|
app.info.Printf("%s New user failed: %s", req.Code, msg)
|
|
|
|
app.info.Printf("%s New user failed: %s", req.Code, msg)
|
|
|
|
respond(401, msg, gc)
|
|
|
|
respond(401, "errorUserExists", gc)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
|
|
|
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
|
|
|
if !(status == 200 || status == 204) || err != nil {
|
|
|
|
if !(status == 200 || status == 204) || err != nil {
|
|
|
|
app.err.Printf("%s New user failed: Jellyfin responded with %d", req.Code, status)
|
|
|
|
app.err.Printf("%s New user failed: Jellyfin responded with %d", req.Code, status)
|
|
|
|
respond(401, "Unknown error", gc)
|
|
|
|
respond(401, app.storage.lang.Admin[app.storage.lang.chosenAdminLang].Notifications.get("errorUnknown"), gc)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.storage.loadProfiles()
|
|
|
|
app.storage.loadProfiles()
|
|
|
|