mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Utils/UI: Make GeneratePassword() use std::string
Just for consistency
This commit is contained in:
parent
a5a19b9952
commit
69ccc99921
@ -67,7 +67,7 @@ void Config::Load()
|
||||
} else {
|
||||
AuthRequired = config_get_bool(obsConfig, CONFIG_SECTION_NAME, PARAM_AUTHREQUIRED);
|
||||
if (FirstLoad) {
|
||||
ServerPassword = Utils::Crypto::GeneratePassword();
|
||||
ServerPassword = QString::fromStdString(Utils::Crypto::GeneratePassword());
|
||||
} else {
|
||||
ServerPassword = config_get_string(obsConfig, CONFIG_SECTION_NAME, PARAM_PASSWORD);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ void SettingsDialog::EnableAuthenticationCheckBoxChanged()
|
||||
|
||||
void SettingsDialog::GeneratePasswordButtonClicked()
|
||||
{
|
||||
QString newPassword = Utils::Crypto::GeneratePassword();
|
||||
QString newPassword = QString::fromStdString(Utils::Crypto::GeneratePassword());
|
||||
ui->serverPasswordLineEdit->setText(newPassword);
|
||||
ui->serverPasswordLineEdit->selectAll();
|
||||
passwordManuallyEdited = false;
|
||||
|
@ -59,13 +59,13 @@ bool Utils::Crypto::CheckAuthenticationString(std::string secret, std::string ch
|
||||
return (authenticationString == expectedAuthenticationString);
|
||||
}
|
||||
|
||||
QString Utils::Crypto::GeneratePassword(size_t length)
|
||||
std::string Utils::Crypto::GeneratePassword(size_t length)
|
||||
{
|
||||
// Get OS random number generator
|
||||
QRandomGenerator *rng = QRandomGenerator::system();
|
||||
|
||||
// Fill string with random alphanumeric
|
||||
QString ret;
|
||||
std::string ret;
|
||||
for (size_t i = 0; i < length; i++)
|
||||
ret += allowedChars[rng->bounded(0, allowedCharsCount)];
|
||||
|
||||
|
@ -8,6 +8,6 @@ namespace Utils {
|
||||
std::string GenerateSalt();
|
||||
std::string GenerateSecret(std::string password, std::string salt);
|
||||
bool CheckAuthenticationString(std::string secret, std::string challenge, std::string authenticationString);
|
||||
QString GeneratePassword(size_t length = 16);
|
||||
std::string GeneratePassword(size_t length = 16);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user