Commit 4a9ed532 authored by jan.koester's avatar jan.koester
Browse files

test

parent ed9d3298
Loading
Loading
Loading
Loading
+7 −1
Changes for src/api/JsonApiServer.cpp: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -143,7 +143,13 @@ void JsonApiController::registerRoutes() {
                            authCtx.origin = auth::AuthOrigin::JsonApi;
                            auto result = _authService.authenticatePassword(
                                username, auth::SecureString(password), authCtx);
                            if (!result.ok() || !result.session) return jsonError("invalid credentials");
                            if (!result.ok() || !result.session) {
                                // Surface the real reason (bad password vs. authdb unreachable
                                // etc. -- see AuthDBAdapter::authenticatePassword) instead of a
                                // blanket "invalid credentials" that hides which one it is.
                                return jsonError(result.message.empty() ? "invalid credentials"
                                                                          : result.message);
                            }

                            JsonGuard resp(json_object_new_object());
                            json_object_object_add(resp, "session_id",