Add MD5 token authentication for Subsonic
This commit is contained in:
@@ -80,6 +80,17 @@ void SubsonicSettingsPage::Load() {
|
||||
ui_->checkbox_verify_certificate->setChecked(s.value("verifycertificate", false).toBool());
|
||||
ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool());
|
||||
ui_->checkbox_server_scrobbling->setChecked(s.value("serversidescrobbling", false).toBool());
|
||||
|
||||
AuthMethod auth_method = static_cast<AuthMethod>(s.value("auth_method", AuthMethod_MD5).toInt());
|
||||
switch(auth_method) {
|
||||
case AuthMethod_Hex:
|
||||
ui_->auth_method_hex->setChecked(true);
|
||||
break;
|
||||
case AuthMethod_MD5:
|
||||
ui_->auth_method_md5->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_subsonicsettingspage->parentWidget());
|
||||
@@ -100,6 +111,12 @@ void SubsonicSettingsPage::Save() {
|
||||
s.setValue("verifycertificate", ui_->checkbox_verify_certificate->isChecked());
|
||||
s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked());
|
||||
s.setValue("serversidescrobbling", ui_->checkbox_server_scrobbling->isChecked());
|
||||
if (ui_->auth_method_hex->isChecked()) {
|
||||
s.setValue("authmethod", AuthMethod_Hex);
|
||||
}
|
||||
else {
|
||||
s.setValue("authmethod", AuthMethod_MD5);
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
@@ -117,7 +134,7 @@ void SubsonicSettingsPage::TestClicked() {
|
||||
return;
|
||||
}
|
||||
|
||||
emit Test(server_url, ui_->username->text(), ui_->password->text());
|
||||
emit Test(server_url, ui_->username->text(), ui_->password->text(), ui_->auth_method_hex->isChecked() ? AuthMethod_Hex : AuthMethod_MD5);
|
||||
ui_->button_test->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,13 +42,18 @@ class SubsonicSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
enum AuthMethod {
|
||||
AuthMethod_Hex,
|
||||
AuthMethod_MD5
|
||||
};
|
||||
|
||||
void Load() override;
|
||||
void Save() override;
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
||||
signals:
|
||||
void Test(QUrl url, QString username, QString password, bool redirect = false);
|
||||
void Test(QUrl url, QString username, QString password, AuthMethod auth_method, bool redirect = false);
|
||||
|
||||
private slots:
|
||||
void TestClicked();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>500</height>
|
||||
<height>644</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -93,6 +93,57 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_auth_method">
|
||||
<property name="title">
|
||||
<string>Authentication method:</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layout_auth_method">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="auth_method_hex">
|
||||
<property name="text">
|
||||
<string>Hex (insecure)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="auth_method_md5">
|
||||
<property name="text">
|
||||
<string>MD5 token</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_auth">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_test">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user