Revert "Don't show private key"

This reverts commit cf604f78f4.
This commit is contained in:
Micah Lee 2021-09-03 14:24:45 -07:00
parent 093bf454a1
commit c5c9df774a
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
6 changed files with 28 additions and 3 deletions

View File

@ -125,6 +125,16 @@ class ServerStatus(QtWidgets.QWidget):
strings._("gui_client_auth_instructions")
)
# The private key itself
self.private_key = QtWidgets.QLabel()
self.private_key.setFont(url_font)
self.private_key.setWordWrap(True)
self.private_key.setMinimumSize(self.private_key.sizeHint())
self.private_key.setStyleSheet(self.common.gui.css["server_status_url"])
self.private_key.setTextInteractionFlags(
Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard
)
# Copy ClientAuth button
self.copy_client_auth_button = QtWidgets.QPushButton(
strings._("gui_copy_client_auth")
@ -166,6 +176,7 @@ class ServerStatus(QtWidgets.QWidget):
client_auth_layout = QtWidgets.QVBoxLayout()
client_auth_layout.addWidget(self.client_auth_instructions)
client_auth_layout.addWidget(self.private_key)
client_auth_layout.addLayout(client_auth_buttons_layout)
# Add the widgets and URL/ClientAuth layouts
@ -287,10 +298,13 @@ class ServerStatus(QtWidgets.QWidget):
if self.settings.get("general", "public"):
self.client_auth_instructions.hide()
self.private_key.hide()
self.copy_client_auth_button.hide()
self.show_client_auth_qr_code_button.hide()
else:
self.client_auth_instructions.show()
self.private_key.setText(self.app.auth_string)
self.private_key.show()
self.copy_client_auth_button.show()
self.show_client_auth_qr_code_button.show()
@ -320,6 +334,7 @@ class ServerStatus(QtWidgets.QWidget):
self.url.hide()
self.copy_url_button.hide()
self.show_url_qr_code_button.hide()
self.private_key.hide()
self.client_auth_instructions.hide()
self.copy_client_auth_button.hide()
self.show_client_auth_qr_code_button.hide()

View File

@ -282,6 +282,13 @@ class GuiBaseTest(unittest.TestCase):
"""Test that the URL instructions for sharing are showing"""
self.assertTrue(tab.get_mode().server_status.url_instructions.isVisible())
def private_key_shown(self, tab):
"""Test that the Private Key is showing when not in public mode"""
if not tab.settings.get("general", "public"):
self.assertTrue(tab.get_mode().server_status.private_key.isVisible())
else:
self.assertFalse(tab.get_mode().server_status.private_key.isVisible())
def client_auth_instructions_shown(self, tab):
"""
Test that the Private Key instructions for sharing
@ -389,15 +396,14 @@ class GuiBaseTest(unittest.TestCase):
self.assertFalse(tab.get_mode().server_status.url.isVisible())
self.assertFalse(tab.get_mode().server_status.url_description.isVisible())
self.assertFalse(tab.get_mode().server_status.url_instructions.isVisible())
self.assertFalse(tab.get_mode().server_status.private_key.isVisible())
self.assertFalse(
tab.get_mode().server_status.client_auth_instructions.isVisible()
)
self.assertFalse(
tab.get_mode().server_status.copy_client_auth_button.isVisible()
)
self.assertFalse(
tab.get_mode().server_status.show_client_auth_qr_code_button.isVisible()
)
def web_server_is_stopped(self, tab):
"""Test that the web server also stopped"""

View File

@ -41,6 +41,7 @@ class TestChat(GuiBaseTest):
self.url_shown(tab)
self.have_copy_url_button(tab)
self.have_show_url_qr_code_button(tab)
self.private_key_shown(tab)
self.client_auth_instructions_shown(tab)
self.have_show_client_auth_qr_code_button(tab)
self.server_status_indicator_says_started(tab)

View File

@ -115,6 +115,7 @@ class TestReceive(GuiBaseTest):
self.have_copy_url_button(tab)
self.have_show_url_qr_code_button(tab)
self.client_auth_instructions_shown(tab)
self.private_key_shown(tab)
self.have_show_client_auth_qr_code_button(tab)
self.server_status_indicator_says_started(tab)

View File

@ -186,6 +186,7 @@ class TestShare(GuiBaseTest):
self.url_shown(tab)
self.have_copy_url_button(tab)
self.have_show_url_qr_code_button(tab)
self.private_key_shown(tab)
self.client_auth_instructions_shown(tab)
self.have_show_client_auth_qr_code_button(tab)
self.server_status_indicator_says_started(tab)

View File

@ -51,6 +51,7 @@ class TestWebsite(GuiBaseTest):
self.have_copy_url_button(tab)
self.have_show_url_qr_code_button(tab)
self.client_auth_instructions_shown(tab)
self.private_key_shown(tab)
self.have_show_client_auth_qr_code_button(tab)
self.server_status_indicator_says_started(tab)