Changed the way services are handled

This commit is contained in:
emeric
2020-08-22 15:20:18 +02:00
parent 9fbbca97a4
commit bd7561af8e
23 changed files with 107 additions and 127 deletions
+4 -4
View File
@@ -120,7 +120,7 @@ class SettingsModel : public Wt::WFormModel
User::PasswordHash passwordHash;
if (!valueText(PasswordField).empty())
passwordHash = ServiceProvider<::Auth::IPasswordService>::get()->hashPassword(valueText(PasswordField).toUTF8());
passwordHash = Service<::Auth::IPasswordService>::get()->hashPassword(valueText(PasswordField).toUTF8());
auto transaction {LmsApp->getDbSession().createUniqueTransaction()};
@@ -243,7 +243,7 @@ class SettingsModel : public Wt::WFormModel
{
if (!valueText(PasswordOldField).empty())
{
switch (ServiceProvider<::Auth::IPasswordService>::get()->checkUserPassword(
switch (Service<::Auth::IPasswordService>::get()->checkUserPassword(
LmsApp->getDbSession(),
boost::asio::ip::address::from_string(LmsApp->environment().clientAddress()),
LmsApp->getUserLoginName(),
@@ -271,7 +271,7 @@ class SettingsModel : public Wt::WFormModel
{
if (!valueText(PasswordField).empty())
{
if (!ServiceProvider<::Auth::IPasswordService>::get()->evaluatePasswordStrength(LmsApp->getUserLoginName(), valueText(PasswordField).toUTF8()))
if (!Service<::Auth::IPasswordService>::get()->evaluatePasswordStrength(LmsApp->getUserLoginName(), valueText(PasswordField).toUTF8()))
error = Wt::WString::tr("Lms.password-too-weak");
}
else
@@ -468,7 +468,7 @@ SettingsView::refreshView()
// Subsonic
{
t->setCondition("if-has-subsonic-api", ServiceProvider<IConfig>::get()->getBool("api-subsonic", true));
t->setCondition("if-has-subsonic-api", Service<IConfig>::get()->getBool("api-subsonic", true));
// Transcode
auto transcode {std::make_unique<Wt::WCheckBox>()};