mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
SettingsDialog: Show confirmation when a custom password is used
This commit is contained in:
parent
5789cf6865
commit
57794a2bf5
@ -15,6 +15,9 @@ OBSWebSocket.Settings.ShowConnectInfo="Show Connect Info"
|
|||||||
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Warning: Currently Live"
|
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Warning: Currently Live"
|
||||||
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="It appears that an output (stream, recording, etc.) is currently active."
|
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="It appears that an output (stream, recording, etc.) is currently active."
|
||||||
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Are you sure that you want to show your connect info?"
|
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Are you sure that you want to show your connect info?"
|
||||||
|
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Warning: Potential Security Issue"
|
||||||
|
OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket stores the server password as plain text. Using a password generated by obs-websocket is highly recommended."
|
||||||
|
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Are you sure you want to use your own password?"
|
||||||
|
|
||||||
OBSWebSocket.SessionTable.Title="Connected WebSocket Sessions"
|
OBSWebSocket.SessionTable.Title="Connected WebSocket Sessions"
|
||||||
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Remote Address"
|
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Remote Address"
|
||||||
|
@ -23,7 +23,8 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
|||||||
QDialog(parent, Qt::Dialog),
|
QDialog(parent, Qt::Dialog),
|
||||||
ui(new Ui::SettingsDialog),
|
ui(new Ui::SettingsDialog),
|
||||||
connectInfo(new ConnectInfo),
|
connectInfo(new ConnectInfo),
|
||||||
sessionTableTimer(new QTimer)
|
sessionTableTimer(new QTimer),
|
||||||
|
passwordManuallyEdited(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->websocketSessionTable->horizontalHeader()->resizeSection(3, 100); // Resize Session Table column widths
|
ui->websocketSessionTable->horizontalHeader()->resizeSection(3, 100); // Resize Session Table column widths
|
||||||
@ -45,6 +46,8 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
|||||||
this, &SettingsDialog::GeneratePasswordButtonClicked);
|
this, &SettingsDialog::GeneratePasswordButtonClicked);
|
||||||
connect(ui->showConnectInfoButton, &QPushButton::clicked,
|
connect(ui->showConnectInfoButton, &QPushButton::clicked,
|
||||||
this, &SettingsDialog::ShowConnectInfoButtonClicked);
|
this, &SettingsDialog::ShowConnectInfoButtonClicked);
|
||||||
|
connect(ui->serverPasswordLineEdit, &QLineEdit::textEdited,
|
||||||
|
this, &SettingsDialog::PasswordEdited);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
@ -79,6 +82,8 @@ void SettingsDialog::showEvent(QShowEvent *event)
|
|||||||
ui->serverPasswordLineEdit->setEnabled(false);
|
ui->serverPasswordLineEdit->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
passwordManuallyEdited = false;
|
||||||
|
|
||||||
FillSessionTable();
|
FillSessionTable();
|
||||||
|
|
||||||
sessionTableTimer->start(1000);
|
sessionTableTimer->start(1000);
|
||||||
@ -119,6 +124,26 @@ void SettingsDialog::SaveFormData()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show a confirmation box to the user if they attempt to provide their own password
|
||||||
|
if (passwordManuallyEdited && (conf->ServerPassword != ui->serverPasswordLineEdit->text())) {
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(obs_module_text("OBSWebSocket.Settings.Save.UserPasswordWarningTitle"));
|
||||||
|
msgBox.setText(obs_module_text("OBSWebSocket.Settings.Save.UserPasswordWarningMessage"));
|
||||||
|
msgBox.setInformativeText(obs_module_text("OBSWebSocket.Settings.Save.UserPasswordWarningInfoText"));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Yes:
|
||||||
|
break;
|
||||||
|
case QMessageBox::No:
|
||||||
|
default:
|
||||||
|
ui->serverPasswordLineEdit->setText(conf->ServerPassword);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool needsRestart = false;
|
bool needsRestart = false;
|
||||||
if ((conf->ServerEnabled != ui->enableWebSocketServerCheckBox->isChecked()) ||
|
if ((conf->ServerEnabled != ui->enableWebSocketServerCheckBox->isChecked()) ||
|
||||||
(conf->DebugEnabled != ui->enableDebugLoggingCheckBox->isChecked()) ||
|
(conf->DebugEnabled != ui->enableDebugLoggingCheckBox->isChecked()) ||
|
||||||
@ -222,6 +247,7 @@ void SettingsDialog::GeneratePasswordButtonClicked()
|
|||||||
QString newPassword = Utils::Crypto::GeneratePassword();
|
QString newPassword = Utils::Crypto::GeneratePassword();
|
||||||
ui->serverPasswordLineEdit->setText(newPassword);
|
ui->serverPasswordLineEdit->setText(newPassword);
|
||||||
ui->serverPasswordLineEdit->selectAll();
|
ui->serverPasswordLineEdit->selectAll();
|
||||||
|
passwordManuallyEdited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::ShowConnectInfoButtonClicked()
|
void SettingsDialog::ShowConnectInfoButtonClicked()
|
||||||
@ -249,3 +275,8 @@ void SettingsDialog::ShowConnectInfoButtonClicked()
|
|||||||
connectInfo->raise();
|
connectInfo->raise();
|
||||||
connectInfo->setFocus();
|
connectInfo->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::PasswordEdited()
|
||||||
|
{
|
||||||
|
passwordManuallyEdited = true;
|
||||||
|
}
|
||||||
|
@ -24,9 +24,11 @@ private Q_SLOTS:
|
|||||||
void EnableAuthenticationCheckBoxChanged();
|
void EnableAuthenticationCheckBoxChanged();
|
||||||
void GeneratePasswordButtonClicked();
|
void GeneratePasswordButtonClicked();
|
||||||
void ShowConnectInfoButtonClicked();
|
void ShowConnectInfoButtonClicked();
|
||||||
|
void PasswordEdited();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsDialog *ui;
|
Ui::SettingsDialog *ui;
|
||||||
ConnectInfo *connectInfo;
|
ConnectInfo *connectInfo;
|
||||||
QTimer *sessionTableTimer;
|
QTimer *sessionTableTimer;
|
||||||
|
bool passwordManuallyEdited;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user