Skip to content

Commit

Permalink
Plain-text password in login dialog implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanda Vacek committed Nov 3, 2023
1 parent 69c4ac7 commit 0fa24ea
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/libshv
2 changes: 1 addition & 1 deletion shvspy/src/appversion.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#define APP_VERSION "1.5.2"
#define APP_VERSION "1.5.3"

1 change: 1 addition & 0 deletions shvspy/src/brokerproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const char *const HOST = "host";
const char *const PORT = "port";
const char *const USER = "user";
const char *const PASSWORD = "password";
const char *const PLAIN_TEXT_PASSWORD = "plainTextPassword";
const char *const AZURELOGIN = "azure";
const char *const SKIPLOGINPHASE = "skipLoginPhase";
const char *const SECURITYTYPE = "securityType";
Expand Down
1 change: 1 addition & 0 deletions shvspy/src/brokerproperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern const char *const HOST;
extern const char *const PORT;
extern const char *const USER;
extern const char *const PASSWORD;
extern const char *const PLAIN_TEXT_PASSWORD;
extern const char *const AZURELOGIN;
extern const char *const SKIPLOGINPHASE;
extern const char *const SECURITYTYPE;
Expand Down
2 changes: 2 additions & 0 deletions shvspy/src/dlgbrokerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ QVariantMap DlgBrokerProperties::brokerProperties() const
ret[PORT] = ui->edPort->value();
ret[USER] = ui->edUser->text();
ret[PASSWORD] = ui->edPassword->text();
ret[PLAIN_TEXT_PASSWORD] = ui->cbPlainTextPassword->isChecked();
ret[AZURELOGIN] = ui->cbLoginWithAzure->isChecked();
ret[SKIPLOGINPHASE] = !ui->grpLogin->isChecked();
ret[SECURITYTYPE] = ui->lstSecurityType->currentText();
Expand Down Expand Up @@ -118,6 +119,7 @@ void DlgBrokerProperties::setBrokerProperties(const QVariantMap &props)
ui->edPort->setValue(props.value(PORT, shv::chainpack::IRpcConnection::DEFAULT_RPC_BROKER_PORT_NONSECURED).toInt());
ui->edUser->setText(props.value(USER).toString());
ui->edPassword->setText(props.value(PASSWORD).toString());
ui->cbPlainTextPassword->setChecked(props.value(PLAIN_TEXT_PASSWORD).toBool());
ui->cbLoginWithAzure->setChecked(props.value(AZURELOGIN).toBool());
ui->edUser->setEnabled(!ui->cbLoginWithAzure->isChecked());
ui->edPassword->setEnabled(!ui->cbLoginWithAzure->isChecked());
Expand Down
17 changes: 12 additions & 5 deletions shvspy/src/dlgbrokerproperties.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>603</width>
<height>658</height>
<height>733</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -330,7 +330,7 @@
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
Expand All @@ -344,6 +344,13 @@
<item row="0" column="1">
<widget class="QLineEdit" name="edUser"/>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cbLoginWithAzure">
<property name="text">
<string>login with Azure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
Expand All @@ -361,10 +368,10 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cbLoginWithAzure">
<item row="1" column="2">
<widget class="QCheckBox" name="cbPlainTextPassword">
<property name="text">
<string>login with Azure</string>
<string>plain text password</string>
</property>
</widget>
</item>
Expand Down
9 changes: 7 additions & 2 deletions shvspy/src/servertreemodel/shvbrokernodeitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,13 @@ void ShvBrokerNodeItem::open()
cli->setLoginType(cp::IRpcConnection::LoginType::Plain);
}
else {
// do not send plain text password over not encrypted socket
cli->setLoginType(cp::IRpcConnection::LoginType::Sha1);
if(m_brokerPropeties.value(brokerProperty::PLAIN_TEXT_PASSWORD).toBool()) {
cli->setLoginType(cp::IRpcConnection::LoginType::Plain);
}
else {
// do not send plain text password over not encrypted socket
cli->setLoginType(cp::IRpcConnection::LoginType::Sha1);
}
}
}
cli->setHost(host);
Expand Down

0 comments on commit 0fa24ea

Please sign in to comment.