Loading src/conf.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -301,20 +301,29 @@ const blogi::AuthSource &blogi::Config::getAuthSource(size_t idx) const { } const blogi::AuthSource *blogi::Config::findAuthSource(const std::string &domain) const { // If only one source and no domain specified, return it // If only one global source and no domain specified, return it if (_AuthSources.size() == 1 && domain.empty()) { return &_AuthSources[0]; } // Search by domain name (case-insensitive) // Search global auth sources by domain name (case-insensitive) for (const auto &src : _AuthSources) { std::string srcDomain = src.domain; std::string searchDomain = domain; // Simple lowercase compare for (auto &c : srcDomain) c = std::tolower(c); for (auto &c : searchDomain) c = std::tolower(c); if (srcDomain == searchDomain) return &src; } // Fallback: if no domain match and only one source, use it // Search domain-specific auth sources for (const auto &dc : _Domains) { std::string dcName = dc.name; std::string searchDomain = domain; for (auto &c : dcName) c = std::tolower(c); for (auto &c : searchDomain) c = std::tolower(c); if (dcName == searchDomain && !dc.authSources.empty()) { return &dc.authSources[0]; } } // Fallback: if no domain match and only one global source, use it if (_AuthSources.size() == 1) { return &_AuthSources[0]; } Loading Loading
src/conf.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -301,20 +301,29 @@ const blogi::AuthSource &blogi::Config::getAuthSource(size_t idx) const { } const blogi::AuthSource *blogi::Config::findAuthSource(const std::string &domain) const { // If only one source and no domain specified, return it // If only one global source and no domain specified, return it if (_AuthSources.size() == 1 && domain.empty()) { return &_AuthSources[0]; } // Search by domain name (case-insensitive) // Search global auth sources by domain name (case-insensitive) for (const auto &src : _AuthSources) { std::string srcDomain = src.domain; std::string searchDomain = domain; // Simple lowercase compare for (auto &c : srcDomain) c = std::tolower(c); for (auto &c : searchDomain) c = std::tolower(c); if (srcDomain == searchDomain) return &src; } // Fallback: if no domain match and only one source, use it // Search domain-specific auth sources for (const auto &dc : _Domains) { std::string dcName = dc.name; std::string searchDomain = domain; for (auto &c : dcName) c = std::tolower(c); for (auto &c : searchDomain) c = std::tolower(c); if (dcName == searchDomain && !dc.authSources.empty()) { return &dc.authSources[0]; } } // Fallback: if no domain match and only one global source, use it if (_AuthSources.size() == 1) { return &_AuthSources[0]; } Loading