mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 23:42:46 -07:00
Disallow setting a blank alternative WebUI location
This commit is contained in:
parent
402715004c
commit
3aeaf6a054
3 changed files with 26 additions and 2 deletions
|
@ -1250,6 +1250,10 @@ void OptionsDialog::on_buttonBox_accepted()
|
||||||
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isAlternativeWebUIPathValid()) {
|
||||||
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_applyButton->setEnabled(false);
|
m_applyButton->setEnabled(false);
|
||||||
this->hide();
|
this->hide();
|
||||||
saveOptions();
|
saveOptions();
|
||||||
|
@ -1269,6 +1273,10 @@ void OptionsDialog::applySettings(QAbstractButton *button)
|
||||||
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isAlternativeWebUIPathValid()) {
|
||||||
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
|
return;
|
||||||
|
}
|
||||||
saveOptions();
|
saveOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1751,6 +1759,15 @@ bool OptionsDialog::webUIAuthenticationOk()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OptionsDialog::isAlternativeWebUIPathValid()
|
||||||
|
{
|
||||||
|
if (m_ui->groupAltWebUI->isChecked() && m_ui->textWebUIRootFolder->selectedPath().trimmed().isEmpty()) {
|
||||||
|
QMessageBox::warning(this, tr("Location Error"), tr("The alternative Web UI files location cannot be blank."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::on_banListButton_clicked()
|
void OptionsDialog::on_banListButton_clicked()
|
||||||
{
|
{
|
||||||
// call dialog window
|
// call dialog window
|
||||||
|
|
|
@ -172,6 +172,7 @@ private:
|
||||||
bool setSslCertificate(const QByteArray &cert);
|
bool setSslCertificate(const QByteArray &cert);
|
||||||
bool schedTimesOk();
|
bool schedTimesOk();
|
||||||
bool webUIAuthenticationOk();
|
bool webUIAuthenticationOk();
|
||||||
|
bool isAlternativeWebUIPathValid();
|
||||||
|
|
||||||
QByteArray m_sslCert, m_sslKey;
|
QByteArray m_sslCert, m_sslKey;
|
||||||
|
|
||||||
|
|
|
@ -1667,8 +1667,14 @@
|
||||||
settings.set('bypass_auth_subnet_whitelist', $('bypass_auth_subnet_whitelist_textarea').getProperty('value'));
|
settings.set('bypass_auth_subnet_whitelist', $('bypass_auth_subnet_whitelist_textarea').getProperty('value'));
|
||||||
|
|
||||||
// Use alternative Web UI
|
// Use alternative Web UI
|
||||||
settings.set('alternative_webui_enabled', $('use_alt_webui_checkbox').getProperty('checked'));
|
var alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
|
||||||
settings.set('alternative_webui_path', $('webui_files_location_textarea').getProperty('value'));
|
var webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
|
||||||
|
if (alternative_webui_enabled && (webui_files_location_textarea.trim() === "")) {
|
||||||
|
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
settings.set('alternative_webui_enabled', alternative_webui_enabled);
|
||||||
|
settings.set('alternative_webui_path', webui_files_location_textarea);
|
||||||
|
|
||||||
settings.set('web_ui_clickjacking_protection_enabled', $('clickjacking_protection_checkbox').getProperty('checked'));
|
settings.set('web_ui_clickjacking_protection_enabled', $('clickjacking_protection_checkbox').getProperty('checked'));
|
||||||
settings.set('web_ui_csrf_protection_enabled', $('csrf_protection_checkbox').getProperty('checked'));
|
settings.set('web_ui_csrf_protection_enabled', $('csrf_protection_checkbox').getProperty('checked'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue