summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug-4985_config-help-menu-non-empty-password1
-rw-r--r--changes/bug-4986_error-joining-string1
-rw-r--r--changes/feature-4488_use-existing-provider-by-default1
-rw-r--r--src/leap/bitmask/backend.py6
-rw-r--r--src/leap/bitmask/config/providerconfig.py10
-rw-r--r--src/leap/bitmask/gui/mainwindow.py5
-rw-r--r--src/leap/bitmask/gui/preferenceswindow.py7
-rw-r--r--src/leap/bitmask/gui/ui/wizard.ui73
-rw-r--r--src/leap/bitmask/gui/wizard.py62
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py15
-rw-r--r--src/leap/bitmask/services/mail/plumber.py11
11 files changed, 96 insertions, 96 deletions
diff --git a/changes/bug-4985_config-help-menu-non-empty-password b/changes/bug-4985_config-help-menu-non-empty-password
new file mode 100644
index 00000000..c6c5266f
--- /dev/null
+++ b/changes/bug-4985_config-help-menu-non-empty-password
@@ -0,0 +1 @@
+- Config help menu: do not use an empty password. Closes #4985.
diff --git a/changes/bug-4986_error-joining-string b/changes/bug-4986_error-joining-string
new file mode 100644
index 00000000..935ba6db
--- /dev/null
+++ b/changes/bug-4986_error-joining-string
@@ -0,0 +1 @@
+- Handle wizard close correctly. Closes #4986.
diff --git a/changes/feature-4488_use-existing-provider-by-default b/changes/feature-4488_use-existing-provider-by-default
new file mode 100644
index 00000000..feeaa349
--- /dev/null
+++ b/changes/feature-4488_use-existing-provider-by-default
@@ -0,0 +1 @@
+- Wizard: select by default the use of an existing provider if we have configured at least one. Closes #4488.
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py
index 6b29d4b3..df79381c 100644
--- a/src/leap/bitmask/backend.py
+++ b/src/leap/bitmask/backend.py
@@ -18,7 +18,6 @@
Backend for everything
"""
import logging
-import os
from Queue import Queue, Empty
@@ -29,6 +28,7 @@ from twisted.python import log
import zope.interface
from leap.bitmask.config.providerconfig import ProviderConfig
+from leap.bitmask.provider import get_provider_path
from leap.bitmask.provider.providerbootstrapper import ProviderBootstrapper
# Frontend side
@@ -155,9 +155,7 @@ class Provider(object):
# we want to connect to other provider...
if (not self._provider_config.loaded() or
self._provider_config.get_domain() != provider):
- self._provider_config.load(
- os.path.join("leap", "providers",
- provider, "provider.json"))
+ self._provider_config.load(get_provider_path(provider))
if self._provider_config.loaded():
d = self._provider_bootstrapper.run_provider_setup_checks(
diff --git a/src/leap/bitmask/config/providerconfig.py b/src/leap/bitmask/config/providerconfig.py
index e80b2337..2ebe05ce 100644
--- a/src/leap/bitmask/config/providerconfig.py
+++ b/src/leap/bitmask/config/providerconfig.py
@@ -21,11 +21,12 @@ Provider configuration
import logging
import os
-from leap.common.check import leap_check
-from leap.common.config.baseconfig import BaseConfig, LocalizedKey
+from leap.bitmask import provider
from leap.bitmask.config.provider_spec import leap_provider_spec
from leap.bitmask.services import get_service_display_name
from leap.bitmask.util import get_path_prefix
+from leap.common.check import leap_check
+from leap.common.config.baseconfig import BaseConfig, LocalizedKey
logger = logging.getLogger(__name__)
@@ -55,10 +56,7 @@ class ProviderConfig(BaseConfig):
:rtype: ProviderConfig or None if there is a problem loading the config
"""
provider_config = ProviderConfig()
- provider_config_path = os.path.join(
- "leap", "providers", domain, "provider.json")
-
- if not provider_config.load(provider_config_path):
+ if not provider_config.load(provider.get_provider_path(domain)):
provider_config = None
return provider_config
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 3f41900b..ffedfa1c 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -888,7 +888,7 @@ class MainWindow(QtGui.QMainWindow):
url = ("<a href='https://addons.mozilla.org/es/thunderbird/"
"addon/bitmask/'>bitmask addon</a>")
- msg = (
+ msg = self.tr(
"<strong>Instructions to use mail:</strong><br>"
"If you use Thunderbird you can use the Bitmask extension helper. "
"Search for 'Bitmask' in the add-on manager or download it "
@@ -898,7 +898,8 @@ class MainWindow(QtGui.QMainWindow):
" Incoming -> IMAP, port: {1}<br>"
" Outgoing -> SMTP, port: {2}<br>"
" Username -> your bitmask username.<br>"
- " Password -> leave it empty."
+ " Password -> does not matter, use any text. "
+ " Just don't leave it empty and don't use your account's password."
"</em>").format(url, IMAP_PORT, smtp_port)
QtGui.QMessageBox.about(self, self.tr("Bitmask Help"), msg)
diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py
index 517a90c4..b2cc2236 100644
--- a/src/leap/bitmask/gui/preferenceswindow.py
+++ b/src/leap/bitmask/gui/preferenceswindow.py
@@ -18,7 +18,6 @@
"""
Preferences window
"""
-import os
import logging
from functools import partial
@@ -26,6 +25,7 @@ from functools import partial
from PySide import QtCore, QtGui
from zope.proxy import sameProxiedObjects
+from leap.bitmask.provider import get_provider_path
from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.gui.ui_preferences import Ui_Preferences
from leap.soledad.client import NoStorageSecret
@@ -383,10 +383,7 @@ class PreferencesWindow(QtGui.QDialog):
:rtype: ProviderConfig or None if there is a problem loading the config
"""
provider_config = ProviderConfig()
- provider_config_path = os.path.join(
- "leap", "providers", domain, "provider.json")
-
- if not provider_config.load(provider_config_path):
+ if not provider_config.load(get_provider_path(domain)):
provider_config = None
return provider_config
diff --git a/src/leap/bitmask/gui/ui/wizard.ui b/src/leap/bitmask/gui/ui/wizard.ui
index cf591470..1ddd854f 100644
--- a/src/leap/bitmask/gui/ui/wizard.ui
+++ b/src/leap/bitmask/gui/ui/wizard.ui
@@ -269,7 +269,20 @@
<string>Configure or select a provider</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0">
+ <item row="5" column="1">
+ <widget class="QLineEdit" name="lnProvider"/>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>https://</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<widget class="QRadioButton" name="rbNewProvider">
<property name="text">
<string>Configure new provider:</string>
@@ -279,30 +292,20 @@
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QRadioButton" name="rbExistingProvider">
+ <item row="5" column="2">
+ <widget class="QPushButton" name="btnCheck">
<property name="text">
- <string>Use existing one:</string>
+ <string>Check</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
+ <item row="2" column="0">
+ <widget class="QRadioButton" name="rbExistingProvider">
<property name="text">
- <string>https://</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ <string>Use existing one:</string>
</property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="lnProvider"/>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="btnCheck">
- <property name="text">
- <string>Check</string>
+ <property name="checked">
+ <bool>false</bool>
</property>
</widget>
</item>
@@ -820,8 +823,8 @@
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel">
- <x>167</x>
- <y>192</y>
+ <x>174</x>
+ <y>174</y>
</hint>
<hint type="destinationlabel">
<x>265</x>
@@ -836,12 +839,12 @@
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel">
- <x>171</x>
- <y>164</y>
+ <x>174</x>
+ <y>227</y>
</hint>
<hint type="destinationlabel">
- <x>246</x>
- <y>164</y>
+ <x>425</x>
+ <y>254</y>
</hint>
</hints>
</connection>
@@ -852,12 +855,12 @@
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>169</x>
- <y>196</y>
+ <x>174</x>
+ <y>174</y>
</hint>
<hint type="destinationlabel">
- <x>327</x>
- <y>163</y>
+ <x>454</x>
+ <y>254</y>
</hint>
</hints>
</connection>
@@ -868,8 +871,8 @@
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>169</x>
- <y>162</y>
+ <x>174</x>
+ <y>227</y>
</hint>
<hint type="destinationlabel">
<x>269</x>
@@ -884,12 +887,12 @@
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>154</x>
- <y>193</y>
+ <x>169</x>
+ <y>174</y>
</hint>
<hint type="destinationlabel">
- <x>498</x>
- <y>170</y>
+ <x>520</x>
+ <y>255</y>
</hint>
</hints>
</connection>
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index b99e8db6..e1bed6b8 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -17,7 +17,6 @@
"""
First run wizard
"""
-import os
import logging
import json
import random
@@ -30,10 +29,11 @@ from twisted.internet import threads
from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.config.providerconfig import ProviderConfig
from leap.bitmask.crypto.srpregister import SRPRegister
+from leap.bitmask.provider import get_provider_path
from leap.bitmask.services import get_service_display_name, get_supported
-from leap.bitmask.util.request_helpers import get_content
from leap.bitmask.util.keyring_helpers import has_keyring
from leap.bitmask.util.password import basic_password_checks
+from leap.bitmask.util.request_helpers import get_content
from ui_wizard import Ui_Wizard
@@ -70,8 +70,6 @@ class Wizard(QtGui.QWizard):
self.ui = Ui_Wizard()
self.ui.setupUi(self)
- self._backend = backend
-
self.setPixmap(QtGui.QWizard.LogoPixmap,
QtGui.QPixmap(":/images/mask-icon.png"))
@@ -90,19 +88,8 @@ class Wizard(QtGui.QWizard):
self.ui.btnCheck.clicked.connect(self._check_provider)
self.ui.lnProvider.returnPressed.connect(self._check_provider)
- self._backend.signaler.prov_name_resolution.connect(
- self._name_resolution)
- self._backend.signaler.prov_https_connection.connect(
- self._https_connection)
- self._backend.signaler.prov_download_provider_info.connect(
- self._download_provider_info)
-
- self._backend.signaler.prov_download_ca_cert.connect(
- self._download_ca_cert)
- self._backend.signaler.prov_check_ca_fingerprint.connect(
- self._check_ca_fingerprint)
- self._backend.signaler.prov_check_api_certificate.connect(
- self._check_api_certificate)
+ self._backend = backend
+ self._backend_connect()
self._domain = None
# HACK!! We need provider_config for the time being, it'll be
@@ -172,6 +159,7 @@ class Wizard(QtGui.QWizard):
self._provider_setup_ok = False
self.ui.lnProvider.setText('')
self.ui.grpCheckProvider.setVisible(False)
+ self._backend_disconnect()
def _load_configured_providers(self):
"""
@@ -205,6 +193,10 @@ class Wizard(QtGui.QWizard):
random.shuffle(pinned) # don't prioritize alphabetically
self.ui.cbProviders.addItems(pinned)
+ # We have configured providers, so by default we select the
+ # 'Use existing provider' option.
+ self.ui.rbExistingProvider.setChecked(True)
+
def get_domain(self):
return self._domain
@@ -487,10 +479,7 @@ class Wizard(QtGui.QWizard):
check. Since this check is the last of this set, it also
completes the page if passed
"""
- if self._provider_config.load(os.path.join("leap",
- "providers",
- self._domain,
- "provider.json")):
+ if self._provider_config.load(get_provider_path(self._domain)):
self._complete_task(data, self.ui.lblProviderInfo,
True, self.SELECT_PROVIDER_PAGE)
self._provider_checks_ok = True
@@ -687,25 +676,36 @@ class Wizard(QtGui.QWizard):
self.ui.lblPassword.setText("")
self.ui.lblPassword2.setText("")
- def closeEvent(self, event):
+ def _backend_connect(self):
+ """
+ Connects all the backend signals with the wizard.
+ """
+ sig = self._backend.signaler
+ sig.prov_name_resolution.connect(self._name_resolution)
+ sig.prov_https_connection.connect(self._https_connection)
+ sig.prov_download_provider_info.connect(self._download_provider_info)
+
+ sig.prov_download_ca_cert.connect(self._download_ca_cert)
+ sig.prov_check_ca_fingerprint.connect(self._check_ca_fingerprint)
+ sig.prov_check_api_certificate.connect(self._check_api_certificate)
+
+ def _backend_disconnect(self):
"""
This method is called when the wizard dialog is closed.
We disconnect all the backend signals in here.
"""
+ sig = self._backend.signaler
try:
# disconnect backend signals
- self._backend.signaler.prov_name_resolution.disconnect(
- self._name_resolution)
- self._backend.signaler.prov_https_connection.disconnect(
- self._https_connection)
- self._backend.signaler.prov_download_provider_info.disconnect(
+ sig.prov_name_resolution.disconnect(self._name_resolution)
+ sig.prov_https_connection.disconnect(self._https_connection)
+ sig.prov_download_provider_info.disconnect(
self._download_provider_info)
- self._backend.signaler.prov_download_ca_cert.disconnect(
- self._download_ca_cert)
- self._backend.signaler.prov_check_ca_fingerprint.disconnect(
+ sig.prov_download_ca_cert.disconnect(self._download_ca_cert)
+ sig.prov_check_ca_fingerprint.disconnect(
self._check_ca_fingerprint)
- self._backend.signaler.prov_check_api_certificate.disconnect(
+ sig.prov_check_api_certificate.disconnect(
self._check_api_certificate)
except RuntimeError:
pass # Signal was not connected
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index 2a66b78c..654d1790 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -24,17 +24,18 @@ import sys
import requests
+from leap.bitmask import provider
+from leap.bitmask import util
from leap.bitmask.config import flags
from leap.bitmask.config.providerconfig import ProviderConfig, MissingCACert
-from leap.bitmask.util.request_helpers import get_content
-from leap.bitmask import util
-from leap.bitmask.util.constants import REQUEST_TIMEOUT
+from leap.bitmask.provider import get_provider_path
from leap.bitmask.services.abstractbootstrapper import AbstractBootstrapper
-from leap.bitmask import provider
+from leap.bitmask.util.constants import REQUEST_TIMEOUT
+from leap.bitmask.util.request_helpers import get_content
from leap.common import ca_bundle
from leap.common.certs import get_digest
-from leap.common.files import check_and_fix_urw_only, get_mtime, mkdir_p
from leap.common.check import leap_assert, leap_assert_type, leap_check
+from leap.common.files import check_and_fix_urw_only, get_mtime, mkdir_p
logger = logging.getLogger(__name__)
@@ -166,8 +167,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
headers = {}
domain = self._domain.encode(sys.getfilesystemencoding())
provider_json = os.path.join(util.get_path_prefix(),
- "leap", "providers", domain,
- "provider.json")
+ get_provider_path(domain))
+
mtime = get_mtime(provider_json)
if self._download_if_needed and mtime:
diff --git a/src/leap/bitmask/services/mail/plumber.py b/src/leap/bitmask/services/mail/plumber.py
index 49514655..07a2608c 100644
--- a/src/leap/bitmask/services/mail/plumber.py
+++ b/src/leap/bitmask/services/mail/plumber.py
@@ -17,8 +17,8 @@
"""
Utils for manipulating local mailboxes.
"""
-import logging
import getpass
+import logging
import os
from collections import defaultdict
@@ -28,8 +28,9 @@ from twisted.internet import defer
from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.config.providerconfig import ProviderConfig
-from leap.bitmask.util import flatten, get_path_prefix
+from leap.bitmask.provider import get_provider_path
from leap.bitmask.services.soledad.soledadbootstrapper import get_db_paths
+from leap.bitmask.util import flatten, get_path_prefix
from leap.mail.imap.account import SoledadBackedAccount
from leap.soledad.client import Soledad
@@ -112,10 +113,8 @@ class MBOXPlumber(object):
self.sol = None
self._settings = LeapSettings()
- provider_config_path = os.path.join(
- get_path_prefix(),
- "leap", "providers",
- provider, "provider.json")
+ provider_config_path = os.path.join(get_path_prefix(),
+ get_provider_path(provider))
provider_config = ProviderConfig()
loaded = provider_config.load(provider_config_path)
if not loaded: