mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
settings: add auth disabled warning
This commit is contained in:
parent
c8ca79f00b
commit
38cf0270b1
@ -6,6 +6,7 @@ OBSWebsocket.Settings.Password="Password"
|
||||
OBSWebsocket.Settings.LockToIPv4="Lock server to only using IPv4"
|
||||
OBSWebsocket.Settings.DebugEnable="Enable debug logging"
|
||||
OBSWebsocket.Settings.AlertsEnable="Enable System Tray Alerts"
|
||||
OBSWebsocket.Settings.AuthDisabledWarning="Running obs-websocket with authentication disabled is not recommended. Are you sure you want to proceed with that change?"
|
||||
OBSWebsocket.NotifyConnect.Title="New WebSocket connection"
|
||||
OBSWebsocket.NotifyConnect.Message="Client %1 connected"
|
||||
OBSWebsocket.NotifyDisconnect.Title="WebSocket client disconnected"
|
||||
|
@ -339,8 +339,8 @@ void Config::FirstRunPasswordSetup()
|
||||
obs_frontend_get_main_window()
|
||||
);
|
||||
|
||||
int proceed = QMessageBox::question(mainWindow, dialogTitle, dialogText, QMessageBox::No, QMessageBox::Yes);
|
||||
if (proceed) {
|
||||
QMessageBox::StandardButton response = QMessageBox::question(mainWindow, dialogTitle, dialogText);
|
||||
if (response == QMessageBox::Yes) {
|
||||
bool promptAccepted = false;
|
||||
QString newPassword = QInputDialog::getText(
|
||||
mainWindow,
|
||||
|
@ -16,12 +16,16 @@ You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "settings-dialog.h"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <obs-module.h>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "../obs-websocket.h"
|
||||
#include "../Config.h"
|
||||
#include "../WSServer.h"
|
||||
#include "settings-dialog.h"
|
||||
|
||||
|
||||
#define CHANGE_ME "changeme"
|
||||
|
||||
@ -35,9 +39,6 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
||||
this, &SettingsDialog::AuthCheckboxChanged);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted,
|
||||
this, &SettingsDialog::FormAccepted);
|
||||
|
||||
|
||||
AuthCheckboxChanged();
|
||||
}
|
||||
|
||||
void SettingsDialog::showEvent(QShowEvent* event) {
|
||||
@ -50,8 +51,12 @@ void SettingsDialog::showEvent(QShowEvent* event) {
|
||||
ui->debugEnabled->setChecked(conf->DebugEnabled);
|
||||
ui->alertsEnabled->setChecked(conf->AlertsEnabled);
|
||||
|
||||
ui->authRequired->blockSignals(true);
|
||||
ui->authRequired->setChecked(conf->AuthRequired);
|
||||
ui->authRequired->blockSignals(false);
|
||||
|
||||
ui->password->setText(CHANGE_ME);
|
||||
ui->password->setEnabled(ui->authRequired->isChecked());
|
||||
}
|
||||
|
||||
void SettingsDialog::ToggleShowHide() {
|
||||
@ -62,10 +67,21 @@ void SettingsDialog::ToggleShowHide() {
|
||||
}
|
||||
|
||||
void SettingsDialog::AuthCheckboxChanged() {
|
||||
if (ui->authRequired->isChecked())
|
||||
if (ui->authRequired->isChecked()) {
|
||||
ui->password->setEnabled(true);
|
||||
else
|
||||
ui->password->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
obs_frontend_push_ui_translation(obs_module_get_string);
|
||||
QString authDisabledWarning = QObject::tr("OBSWebsocket.Settings.AuthDisabledWarning");
|
||||
obs_frontend_pop_ui_translation();
|
||||
|
||||
QMessageBox::StandardButton response = QMessageBox::question(this, "obs-websocket", authDisabledWarning);
|
||||
if (response == QMessageBox::Yes) {
|
||||
ui->password->setEnabled(false);
|
||||
} else {
|
||||
ui->authRequired->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::FormAccepted() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user