summaryrefslogtreecommitdiff
path: root/src/leap/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/gui')
-rw-r--r--src/leap/gui/firstrun/__init__.py5
-rw-r--r--src/leap/gui/firstrun/connect.py (renamed from src/leap/gui/firstrun/regvalidation.py)160
-rw-r--r--src/leap/gui/firstrun/intro.py8
-rw-r--r--src/leap/gui/firstrun/last.py33
-rw-r--r--src/leap/gui/firstrun/login.py13
-rw-r--r--src/leap/gui/firstrun/providerinfo.py18
-rw-r--r--src/leap/gui/firstrun/providerselect.py19
-rw-r--r--src/leap/gui/firstrun/providersetup.py55
-rw-r--r--src/leap/gui/firstrun/register.py30
-rwxr-xr-xsrc/leap/gui/firstrun/tests/integration/fake_provider.py6
-rwxr-xr-xsrc/leap/gui/firstrun/wizard.py13
-rw-r--r--src/leap/gui/progress.py7
-rw-r--r--src/leap/gui/tests/test_firstrun_login.py2
-rw-r--r--src/leap/gui/tests/test_firstrun_providerselect.py8
-rw-r--r--src/leap/gui/tests/test_firstrun_register.py6
-rw-r--r--src/leap/gui/tests/test_firstrun_wizard.py8
16 files changed, 203 insertions, 188 deletions
diff --git a/src/leap/gui/firstrun/__init__.py b/src/leap/gui/firstrun/__init__.py
index d380b75a..2a523d6a 100644
--- a/src/leap/gui/firstrun/__init__.py
+++ b/src/leap/gui/firstrun/__init__.py
@@ -6,6 +6,7 @@ except ValueError:
pass
import intro
+import connect
import last
import login
import mixins
@@ -13,10 +14,10 @@ import providerinfo
import providerselect
import providersetup
import register
-import regvalidation
__all__ = [
'intro',
+ 'connect',
'last',
'login',
'mixins',
@@ -24,4 +25,4 @@ __all__ = [
'providerselect',
'providersetup',
'register',
- 'regvalidation'] # ,'wizard']
+ ] # ,'wizard']
diff --git a/src/leap/gui/firstrun/regvalidation.py b/src/leap/gui/firstrun/connect.py
index b86583e0..ad7bb13a 100644
--- a/src/leap/gui/firstrun/regvalidation.py
+++ b/src/leap/gui/firstrun/connect.py
@@ -2,15 +2,7 @@
Provider Setup Validation Page,
used in First Run Wizard
"""
-# XXX This page is called regvalidation
-# but it's implementing functionality in the former
-# connect page.
-# We should remame it to connect again, when we integrate
-# the login branch of the wizard.
-
import logging
-#import json
-#import socket
from PyQt4 import QtGui
@@ -25,15 +17,15 @@ from leap.gui.constants import APP_LOGO
logger = logging.getLogger(__name__)
-class RegisterUserValidationPage(ValidationPage):
+class ConnectionPage(ValidationPage):
def __init__(self, parent=None):
- super(RegisterUserValidationPage, self).__init__(parent)
- self.current_page = "signupvalidation"
+ super(ConnectionPage, self).__init__(parent)
+ self.current_page = "connect"
- title = "Connecting..."
- # XXX uh... really?
- subtitle = "Checking connection with provider."
+ title = self.tr("Connecting...")
+ subtitle = self.tr("Setting up a encrypted "
+ "connection with the provider")
self.setTitle(title)
self.setSubTitle(subtitle)
@@ -52,32 +44,31 @@ class RegisterUserValidationPage(ValidationPage):
wizard = self.wizard()
full_domain = self.field('provider_domain')
domain, port = get_https_domain_and_port(full_domain)
- _domain = u"%s:%s" % (domain, port) if port != 443 else unicode(domain)
- # FIXME #BUG 638 FIXME FIXME FIXME
- verify = False # !!!!!!!!!!!!!!!!
- # FIXME #BUG 638 FIXME FIXME FIXME
+ pconfig = wizard.eipconfigchecker(domain=domain)
+ # this should be persisted...
+ pconfig.defaultprovider.load()
+ pconfig.set_api_domain()
+
+ pCertChecker = wizard.providercertchecker(
+ domain=domain)
+ pCertChecker.set_api_domain(pconfig.apidomain)
###########################################
# Set Credentials.
# username and password are in different fields
# if they were stored in log_in or sign_up pages.
- is_signup = self.field("is_signup")
+ from_login = wizard.from_login
unamek_base = 'userName'
passwk_base = 'userPassword'
- unamek = 'login_%s' % unamek_base if not is_signup else unamek_base
- passwk = 'login_%s' % passwk_base if not is_signup else passwk_base
+ unamek = 'login_%s' % unamek_base if from_login else unamek_base
+ passwk = 'login_%s' % passwk_base if from_login else passwk_base
username = self.field(unamek)
password = self.field(passwk)
credentials = username, password
- eipconfigchecker = wizard.eipconfigchecker(domain=_domain)
- #XXX change for _domain (sanitized)
- pCertChecker = wizard.providercertchecker(
- domain=full_domain)
-
yield(("head_sentinel", 0), lambda: None)
##################################################
@@ -85,14 +76,13 @@ class RegisterUserValidationPage(ValidationPage):
##################################################
def fetcheipconf():
try:
- eipconfigchecker.fetch_eip_service_config(
- domain=full_domain)
+ pconfig.fetch_eip_service_config()
# XXX get specific exception
except Exception as exc:
return self.fail(exc.message)
- yield((self.tr("Fetching provider config..."), 40),
+ yield((self.tr("Getting EIP configuration files"), 40),
fetcheipconf)
##################################################
@@ -102,19 +92,21 @@ class RegisterUserValidationPage(ValidationPage):
def fetcheipcert():
try:
downloaded = pCertChecker.download_new_client_cert(
- credentials=credentials,
- verify=verify)
+ credentials=credentials)
if not downloaded:
- logger.error('Could not download client cert.')
+ logger.error('Could not download client cert')
return False
except auth.SRPAuthenticationError as exc:
return self.fail(self.tr(
"Authentication error: %s" % exc.message))
+
+ except Exception as exc:
+ return self.fail(exc.message)
else:
return True
- yield((self.tr("Fetching eip certificate"), 80),
+ yield((self.tr("Getting EIP certificate"), 80),
fetcheipcert)
################
@@ -128,9 +120,11 @@ class RegisterUserValidationPage(ValidationPage):
called after _do_checks has finished
(connected to checker thread finished signal)
"""
- # this should be called CONNECT PAGE AGAIN.
# here we go! :)
if self.is_done():
+ nextbutton = self.wizard().button(QtGui.QWizard.NextButton)
+ nextbutton.setFocus()
+
full_domain = self.field('provider_domain')
domain, port = get_https_domain_and_port(full_domain)
_domain = u"%s:%s" % (
@@ -146,10 +140,15 @@ class RegisterUserValidationPage(ValidationPage):
if conductor:
conductor.set_provider_domain(domain)
- conductor.run_checks()
- self.conductor = conductor
- errors = self.eip_error_check()
- if not errors and start_eip_signal:
+ # we could run some of the checks to be
+ # sure everything is in order, but
+ # I see no point in doing it, we assume
+ # we've gone thru all checks during the wizard.
+ #conductor.run_checks()
+ #self.conductor = conductor
+ #errors = self.eip_error_check()
+ #if not errors and start_eip_signal:
+ if start_eip_signal:
start_eip_signal.emit()
else:
@@ -158,53 +157,58 @@ class RegisterUserValidationPage(ValidationPage):
"probably the wizard has been launched "
"in an stand-alone way.")
- # XXX look for a better place to signal
- # we are done.
- # We could probably have a fake validatePage
- # that checks if the domain transfer has been
- # done to conductor object, triggers the start_signal
- # and does the go_next()
self.set_done()
- def eip_error_check(self):
- """
- a version of the main app error checker,
- but integrated within the connecting page of the wizard.
- consumes the conductor error queue.
- pops errors, and add those to the wizard page
- """
- logger.debug('eip error check from connecting page')
- errq = self.conductor.error_queue
- # XXX missing!
-
- def _do_validation(self):
- """
- called after _do_checks has finished
- (connected to checker thread finished signal)
- """
- is_signup = self.field("is_signup")
- prevpage = "signup" if is_signup else "login"
-
- wizard = self.wizard()
- if self.errors:
- logger.debug('going back with errors')
- logger.error(self.errors)
- name, first_error = self.pop_first_error()
- wizard.set_validation_error(
- prevpage,
- first_error)
- self.go_back()
- else:
- logger.debug('should go next, wait for user to click next')
- #self.go_next()
+ #def eip_error_check(self):
+ #"""
+ #a version of the main app error checker,
+ #but integrated within the connecting page of the wizard.
+ #consumes the conductor error queue.
+ #pops errors, and add those to the wizard page
+ #"""
+ # TODO handle errors.
+ # We should redirect them to the log viewer
+ # with a brief message.
+ # XXX move to LAST PAGE instead.
+ #logger.debug('eip error check from connecting page')
+ #errq = self.conductor.error_queue
+
+ #def _do_validation(self):
+ #"""
+ #called after _do_checks has finished
+ #(connected to checker thread finished signal)
+ #"""
+ #from_login = self.wizard().from_login
+ #prevpage = "login" if from_login else "signup"
+
+ #wizard = self.wizard()
+ #if self.errors:
+ #logger.debug('going back with errors')
+ #logger.error(self.errors)
+ #name, first_error = self.pop_first_error()
+ #wizard.set_validation_error(
+ #prevpage,
+ #first_error)
+ #self.go_back()
def nextId(self):
wizard = self.wizard()
- if not wizard:
- return
return wizard.get_page_index('lastpage')
def initializePage(self):
- super(RegisterUserValidationPage, self).initializePage()
+ super(ConnectionPage, self).initializePage()
self.set_undone()
+ cancelbutton = self.wizard().button(QtGui.QWizard.CancelButton)
+ cancelbutton.hide()
self.completeChanged.emit()
+
+ wizard = self.wizard()
+ eip_statuschange_signal = wizard.eip_statuschange_signal
+ if eip_statuschange_signal:
+ eip_statuschange_signal.connect(
+ lambda status: self.send_status(
+ status))
+
+ def send_status(self, status):
+ wizard = self.wizard()
+ wizard.openvpn_status.append(status)
diff --git a/src/leap/gui/firstrun/intro.py b/src/leap/gui/firstrun/intro.py
index 0a7484e2..b519362f 100644
--- a/src/leap/gui/firstrun/intro.py
+++ b/src/leap/gui/firstrun/intro.py
@@ -11,7 +11,7 @@ class IntroPage(QtGui.QWizardPage):
def __init__(self, parent=None):
super(IntroPage, self).__init__(parent)
- self.setTitle(self.tr("First run wizard."))
+ self.setTitle(self.tr("First run wizard"))
#self.setPixmap(
#QtGui.QWizard.WatermarkPixmap,
@@ -35,10 +35,10 @@ class IntroPage(QtGui.QWizardPage):
radiobuttonGroup = QtGui.QGroupBox()
self.sign_up = QtGui.QRadioButton(
- self.tr("Sign up for a new account."))
+ self.tr("Sign up for a new account"))
self.sign_up.setChecked(True)
self.log_in = QtGui.QRadioButton(
- self.tr("Log In with my credentials."))
+ self.tr("Log In with my credentials"))
radiobLayout = QtGui.QVBoxLayout()
radiobLayout.addWidget(self.sign_up)
@@ -50,7 +50,7 @@ class IntroPage(QtGui.QWizardPage):
layout.addWidget(radiobuttonGroup)
self.setLayout(layout)
- self.registerField('is_signup', self.sign_up)
+ #self.registerField('is_signup', self.sign_up)
def validatePage(self):
return True
diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py
index 1d8caca4..32d98acc 100644
--- a/src/leap/gui/firstrun/last.py
+++ b/src/leap/gui/firstrun/last.py
@@ -15,7 +15,8 @@ class LastPage(QtGui.QWizardPage):
def __init__(self, parent=None):
super(LastPage, self).__init__(parent)
- self.setTitle("Connecting to Encrypted Internet Proxy service...")
+ self.setTitle(self.tr(
+ "Connecting to Encrypted Internet Proxy service..."))
self.setPixmap(
QtGui.QWizard.LogoPixmap,
@@ -33,6 +34,7 @@ class LastPage(QtGui.QWizardPage):
self.status_line_2 = QtGui.QLabel()
self.status_line_3 = QtGui.QLabel()
self.status_line_4 = QtGui.QLabel()
+ self.status_line_5 = QtGui.QLabel()
layout = QtGui.QVBoxLayout()
layout.addWidget(self.label)
@@ -42,6 +44,7 @@ class LastPage(QtGui.QWizardPage):
layout.addWidget(self.status_line_2)
layout.addWidget(self.status_line_3)
layout.addWidget(self.status_line_4)
+ layout.addWidget(self.status_line_5)
self.setLayout(layout)
@@ -51,13 +54,13 @@ class LastPage(QtGui.QWizardPage):
statusline.setText(status)
def set_finished_status(self):
- self.setTitle('You are now using an encrypted connection!')
+ self.setTitle(self.tr('You are now using an encrypted connection!'))
finishText = self.wizard().buttonText(
QtGui.QWizard.FinishButton)
finishText = finishText.replace('&', '')
- self.label.setText(
+ self.label.setText(self.tr(
"Click '<i>%s</i>' to end the wizard and "
- "save your settings." % finishText)
+ "save your settings." % finishText))
# XXX init network checker
# trigger signal
@@ -67,7 +70,7 @@ class LastPage(QtGui.QWizardPage):
# signals. See progress.py
logger.debug('logging status in last page')
self.validation_done = False
- status_count = 0
+ status_count = 1
try:
while True:
status = (yield)
@@ -84,11 +87,23 @@ class LastPage(QtGui.QWizardPage):
pass
def initializePage(self):
+ super(LastPage, self).initializePage()
wizard = self.wizard()
- if not wizard:
- return
- eip_status_handler = self.eip_status_handler()
+ handler = self.eip_status_handler()
+
+ # get statuses done in prev page
+ for st in wizard.openvpn_status:
+ self.send_status(handler.send, st)
+
+ # bind signal for events yet to come
eip_statuschange_signal = wizard.eip_statuschange_signal
if eip_statuschange_signal:
eip_statuschange_signal.connect(
- lambda status: eip_status_handler.send(status))
+ lambda status: self.send_status(
+ handler.send, status))
+
+ def send_status(self, cb, status):
+ try:
+ cb(status)
+ except StopIteration:
+ pass
diff --git a/src/leap/gui/firstrun/login.py b/src/leap/gui/firstrun/login.py
index e7afee9f..3707d3ff 100644
--- a/src/leap/gui/firstrun/login.py
+++ b/src/leap/gui/firstrun/login.py
@@ -21,8 +21,8 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
super(LogInPage, self).__init__(parent)
self.current_page = "login"
- self.setTitle("Log In")
- self.setSubTitle("Log in with your credentials.")
+ self.setTitle(self.tr("Log In"))
+ self.setSubTitle(self.tr("Log in with your credentials"))
self.current_page = "login"
self.setPixmap(
@@ -35,7 +35,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
self.do_confirm_next = False
def setupUI(self):
- userNameLabel = QtGui.QLabel("User &name:")
+ userNameLabel = QtGui.QLabel(self.tr("User &name:"))
userNameLineEdit = QtGui.QLineEdit()
userNameLineEdit.cursorPositionChanged.connect(
self.reset_validation_status)
@@ -50,7 +50,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
#'username@provider.example.org')
self.userNameLineEdit = userNameLineEdit
- userPasswordLabel = QtGui.QLabel("&Password:")
+ userPasswordLabel = QtGui.QLabel(self.tr("&Password:"))
self.userPasswordLineEdit = QtGui.QLineEdit()
self.userPasswordLineEdit.setEchoMode(
QtGui.QLineEdit.Password)
@@ -77,7 +77,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
layout.addWidget(self.valFrame, 4, 2, 4, 2)
self.valFrame.hide()
- self.nextText("Log in")
+ self.nextText(self.tr("Log in"))
self.setLayout(layout)
#self.registerField('is_login_wizard')
@@ -108,7 +108,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
# page here as a mean to catch
# srp authentication errors while
wizard = self.wizard()
- eipconfigchecker = wizard.eipconfigchecker()
+ eipconfigchecker = wizard.eipconfigchecker(domain=domain)
########################
# 1) try name resolution
@@ -321,6 +321,7 @@ class LogInPage(InlineValidationPage, UserFormMixIn): # InlineValidationPage
self.setField('provider_domain', domain)
self.setField('login_userName', username)
self.setField('login_userPassword', password)
+ self.wizard().from_login = True
return True
diff --git a/src/leap/gui/firstrun/providerinfo.py b/src/leap/gui/firstrun/providerinfo.py
index c5b2984c..cff4caca 100644
--- a/src/leap/gui/firstrun/providerinfo.py
+++ b/src/leap/gui/firstrun/providerinfo.py
@@ -6,6 +6,7 @@ import logging
from PyQt4 import QtGui
from leap.gui.constants import APP_LOGO
+from leap.util.translations import translate
logger = logging.getLogger(__name__)
@@ -15,9 +16,9 @@ class ProviderInfoPage(QtGui.QWizardPage):
def __init__(self, parent=None):
super(ProviderInfoPage, self).__init__(parent)
- self.setTitle(self.tr("Provider Info"))
+ self.setTitle(self.tr("Provider Information"))
self.setSubTitle(self.tr(
- "This is what provider says."))
+ "Services offered by this provider"))
self.setPixmap(
QtGui.QWizard.LogoPixmap,
@@ -62,6 +63,7 @@ class ProviderInfoPage(QtGui.QWizardPage):
# this should be better handled with signals !!
self.displayName = displayName
self.description = description
+ self.description.setWordWrap(True)
self.enrollment_policy = enrollment_policy
def show_provider_info(self):
@@ -72,7 +74,7 @@ class ProviderInfoPage(QtGui.QWizardPage):
lang = "en"
pconfig = self.wizard().providerconfig
- dn = pconfig.get('display_name')
+ dn = pconfig.get('name')
display_name = dn[lang] if dn else ''
domain_name = self.field('provider_domain')
@@ -80,14 +82,20 @@ class ProviderInfoPage(QtGui.QWizardPage):
"<b>%s</b> https://%s" % (display_name, domain_name))
desc = pconfig.get('description')
- description_text = desc[lang] if desc else ''
+
+ #description_text = desc[lang] if desc else ''
+ description_text = translate(desc) if desc else ''
+
self.description.setText(
"<i>%s</i>" % description_text)
+ # XXX should translate this...
enroll = pconfig.get('enrollment_policy')
if enroll:
self.enrollment_policy.setText(
- 'enrollment policy: %s' % enroll)
+ '<b>%s</b>: <em>%s</em>' % (
+ self.tr('enrollment policy'),
+ enroll))
def nextId(self):
wizard = self.wizard()
diff --git a/src/leap/gui/firstrun/providerselect.py b/src/leap/gui/firstrun/providerselect.py
index fd48f7f9..917b16fd 100644
--- a/src/leap/gui/firstrun/providerselect.py
+++ b/src/leap/gui/firstrun/providerselect.py
@@ -32,7 +32,7 @@ class SelectProviderPage(InlineValidationPage):
self.setTitle(self.tr("Enter Provider"))
self.setSubTitle(self.tr(
"Please enter the domain of the provider you want "
- "to use for your connection.")
+ "to use for your connection")
)
self.setPixmap(
QtGui.QWizard.LogoPixmap,
@@ -64,7 +64,7 @@ class SelectProviderPage(InlineValidationPage):
providerNameLabel.setBuddy(providerNameEdit)
# add regex validator
- providerDomainRe = QtCore.QRegExp(r"^[a-z\d_-.]+$")
+ providerDomainRe = QtCore.QRegExp(r"^[a-z1-9_\-\.]+$")
providerNameEdit.setValidator(
QtGui.QRegExpValidator(providerDomainRe, self))
self.providerNameEdit = providerNameEdit
@@ -101,7 +101,7 @@ class SelectProviderPage(InlineValidationPage):
self.certInfo.setWordWrap(True)
self.certWarning = QtGui.QLabel("")
self.trustProviderCertCheckBox = QtGui.QCheckBox(
- "&Trust this provider certificate.")
+ self.tr("&Trust this provider certificate."))
self.trustProviderCertCheckBox.stateChanged.connect(
self.onTrustCheckChanged)
@@ -219,7 +219,7 @@ class SelectProviderPage(InlineValidationPage):
return True
logger.debug('checking name resolution')
- yield((self.tr("checking domain name"), 20), namecheck)
+ yield((self.tr("Checking if it is a valid provider"), 20), namecheck)
#########################
# 2) try https connection
@@ -273,7 +273,7 @@ class SelectProviderPage(InlineValidationPage):
return True
logger.debug('checking https connection')
- yield((self.tr("checking https connection"), 40), httpscheck)
+ yield((self.tr("Checking for a secure connection"), 40), httpscheck)
##################################
# 3) try download provider info...
@@ -287,8 +287,6 @@ class SelectProviderPage(InlineValidationPage):
wizard.set_providerconfig(
eipconfigchecker.defaultprovider.config)
except requests.exceptions.SSLError:
- # XXX we should have catched this before.
- # but cert checking is broken.
return self.fail(self.tr(
"Could not get info from provider."))
except requests.exceptions.ConnectionError:
@@ -302,7 +300,7 @@ class SelectProviderPage(InlineValidationPage):
else:
return True
- yield((self.tr("fetching provider info"), 80), fetchinfo)
+ yield((self.tr("Getting info from the provider"), 80), fetchinfo)
# done!
@@ -344,9 +342,10 @@ class SelectProviderPage(InlineValidationPage):
def add_cert_info(self, certinfo): # pragma: no cover XXX
self.certWarning.setText(
- "Do you want to <b>trust this provider certificate?</b>")
+ self.tr("Do you want to <b>trust this provider certificate?</b>"))
+ # XXX Check if this needs to abstracted to remove certinfo
self.certInfo.setText(
- 'SHA-256 fingerprint: <i>%s</i><br>' % certinfo)
+ self.tr('SHA-256 fingerprint: <i>%s</i><br>' % certinfo))
self.certInfo.setWordWrap(True)
self.certinfoGroup.show()
diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py
index 1a362794..47060f6e 100644
--- a/src/leap/gui/firstrun/providersetup.py
+++ b/src/leap/gui/firstrun/providersetup.py
@@ -4,6 +4,8 @@ used if First Run Wizard
"""
import logging
+import requests
+
from PyQt4 import QtGui
from leap.base import exceptions as baseexceptions
@@ -20,12 +22,12 @@ class ProviderSetupValidationPage(ValidationPage):
self.current_page = "providersetupvalidation"
# XXX needed anymore?
- is_signup = self.field("is_signup")
- self.is_signup = is_signup
+ #is_signup = self.field("is_signup")
+ #self.is_signup = is_signup
self.setTitle(self.tr("Provider setup"))
self.setSubTitle(
- self.tr("Doing autoconfig."))
+ self.tr("Gathering configuration options for this provider"))
self.setPixmap(
QtGui.QWizard.LogoPixmap,
@@ -110,26 +112,15 @@ class ProviderSetupValidationPage(ValidationPage):
#########################
def validatecacert():
- pass
- #api_uri = pconfig.get('api_uri', None)
- #try:
- #api_cert_verified = pCertChecker.verify_api_https(api_uri)
- #except requests.exceptions.SSLError as exc:
- #logger.error('BUG #638. %s' % exc.message)
- # XXX RAISE! See #638
- # bypassing until the hostname is fixed.
- # We probably should raise yet-another-warning
- # here saying user that the hostname "XX.XX.XX.XX' does not
- # match 'foo.bar.baz'
- #api_cert_verified = True
-
- #if not api_cert_verified:
- # XXX update validationMsg
- # should catch exception
- #return False
-
- #???
- #ca_cert_path = checker.ca_cert_path
+ api_uri = pconfig.get('api_uri', None)
+ try:
+ pCertChecker.verify_api_https(api_uri)
+ except requests.exceptions.SSLError as exc:
+ return self.fail("Validation Error")
+ except Exception as exc:
+ return self.fail(exc.msg)
+ else:
+ return True
yield((self.tr('Validating api certificate'), 90), validatecacert)
@@ -141,8 +132,8 @@ class ProviderSetupValidationPage(ValidationPage):
called after _do_checks has finished
(connected to checker thread finished signal)
"""
- prevpage = "providerselection" if self.is_signup else "login"
wizard = self.wizard()
+ prevpage = "login" if wizard.from_login else "providerselection"
if self.errors:
logger.debug('going back with errors')
@@ -150,22 +141,14 @@ class ProviderSetupValidationPage(ValidationPage):
wizard.set_validation_error(
prevpage,
first_error)
- # XXX don't go back, signal error
- #self.go_back()
- else:
- logger.debug('should be going next, wait on user')
- #self.go_next()
def nextId(self):
wizard = self.wizard()
- if not wizard:
- return
- is_signup = self.field('is_signup')
- if is_signup is True:
+ from_login = wizard.from_login
+ if from_login:
+ next_ = 'connect'
+ else:
next_ = 'signup'
- if is_signup is False:
- # XXX bad name. change to connect again.
- next_ = 'signupvalidation'
return wizard.get_page_index(next_)
def initializePage(self):
diff --git a/src/leap/gui/firstrun/register.py b/src/leap/gui/firstrun/register.py
index 4c811093..15278330 100644
--- a/src/leap/gui/firstrun/register.py
+++ b/src/leap/gui/firstrun/register.py
@@ -45,7 +45,7 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
self.focused_field = False
def setupUI(self):
- userNameLabel = QtGui.QLabel("User &name:")
+ userNameLabel = QtGui.QLabel(self.tr("User &name:"))
userNameLineEdit = QtGui.QLineEdit()
userNameLineEdit.cursorPositionChanged.connect(
self.reset_validation_status)
@@ -57,20 +57,20 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
QtGui.QRegExpValidator(usernameRe, self))
self.userNameLineEdit = userNameLineEdit
- userPasswordLabel = QtGui.QLabel("&Password:")
+ userPasswordLabel = QtGui.QLabel(self.tr("&Password:"))
self.userPasswordLineEdit = QtGui.QLineEdit()
self.userPasswordLineEdit.setEchoMode(
QtGui.QLineEdit.Password)
userPasswordLabel.setBuddy(self.userPasswordLineEdit)
- userPassword2Label = QtGui.QLabel("Password (again):")
+ userPassword2Label = QtGui.QLabel(self.tr("Password (again):"))
self.userPassword2LineEdit = QtGui.QLineEdit()
self.userPassword2LineEdit.setEchoMode(
QtGui.QLineEdit.Password)
userPassword2Label.setBuddy(self.userPassword2LineEdit)
rememberPasswordCheckBox = QtGui.QCheckBox(
- "&Remember username and password.")
+ self.tr("&Remember username and password."))
rememberPasswordCheckBox.setChecked(True)
self.registerField('userName*', self.userNameLineEdit)
@@ -224,11 +224,17 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
generator that yields actual checks
that are executed in a separate thread
"""
+ wizard = self.wizard()
+
provider = self.field('provider_domain')
username = self.userNameLineEdit.text()
password = self.userPasswordLineEdit.text()
password2 = self.userPassword2LineEdit.text()
+ pconfig = wizard.eipconfigchecker(domain=provider)
+ pconfig.defaultprovider.load()
+ pconfig.set_api_domain()
+
def checkpass():
# we better have here
# some call to a password checker...
@@ -263,14 +269,11 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
self, "showStepsFrame")
def register():
- # XXX FIXME!
- verify = False
signup = auth.LeapSRPRegister(
schema="https",
- provider=provider,
- verify=verify)
- #import ipdb;ipdb.set_trace()
+ provider=pconfig.apidomain,
+ verify=pconfig.cacert)
try:
ok, req = signup.register_user(
username, password)
@@ -312,7 +315,7 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
return True
logger.debug('registering user')
- yield(("registering with provider", 40), register)
+ yield(("Registering username", 40), register)
self.set_done()
yield(("end_sentinel", 100), lambda: None)
@@ -373,7 +376,7 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
#self.tr("Register a new user with provider %s.") %
#provider)
self.setSubTitle(
- self.tr("Register a new user with provider %s." %
+ self.tr("Register a new user with provider <em>%s</em>" %
provider))
self.validationMsg.setText('')
self.userPassword2LineEdit.setText('')
@@ -381,7 +384,4 @@ class RegisterUserPage(InlineValidationPage, UserFormMixIn):
def nextId(self):
wizard = self.wizard()
- #if not wizard:
- #return
- # XXX this should be called connect
- return wizard.get_page_index('signupvalidation')
+ return wizard.get_page_index('connect')
diff --git a/src/leap/gui/firstrun/tests/integration/fake_provider.py b/src/leap/gui/firstrun/tests/integration/fake_provider.py
index 445b4487..668db5d1 100755
--- a/src/leap/gui/firstrun/tests/integration/fake_provider.py
+++ b/src/leap/gui/firstrun/tests/integration/fake_provider.py
@@ -25,9 +25,9 @@ import sys
import srp
# GnuTLS Example -- is not working as expected
-from gnutls import crypto
-from gnutls.constants import COMP_LZO, COMP_DEFLATE, COMP_NULL
-from gnutls.interfaces.twisted import X509Credentials
+#from gnutls import crypto
+#from gnutls.constants import COMP_LZO, COMP_DEFLATE, COMP_NULL
+#from gnutls.interfaces.twisted import X509Credentials
# Going with OpenSSL as a workaround instead
# But we DO NOT want to introduce this dependency.
diff --git a/src/leap/gui/firstrun/wizard.py b/src/leap/gui/firstrun/wizard.py
index 89209401..f198dca0 100755
--- a/src/leap/gui/firstrun/wizard.py
+++ b/src/leap/gui/firstrun/wizard.py
@@ -59,8 +59,8 @@ def get_pages_dict():
('providersetupvalidation',
firstrun.providersetup.ProviderSetupValidationPage),
('signup', firstrun.register.RegisterUserPage),
- ('signupvalidation',
- firstrun.regvalidation.RegisterUserValidationPage),
+ ('connect',
+ firstrun.connect.ConnectionPage),
('lastpage', firstrun.last.LastPage)
))
@@ -72,7 +72,7 @@ class FirstRunWizard(QtGui.QWizard):
conductor_instance,
parent=None,
pages_dict=None,
- eip_username=None,
+ username=None,
providers=None,
success_cb=None, is_provider_setup=False,
trusted_certs=None,
@@ -92,7 +92,7 @@ class FirstRunWizard(QtGui.QWizard):
# in the connection page, before the wizard has ended.
self.conductor = conductor_instance
- self.eip_username = eip_username
+ self.username = username
self.providers = providers
# success callback
@@ -129,13 +129,14 @@ class FirstRunWizard(QtGui.QWizard):
# by setting 1st page??
#self.is_previously_registered = is_previously_registered
# XXX ??? ^v
- self.is_previously_registered = bool(self.eip_username)
+ self.is_previously_registered = bool(self.username)
self.from_login = False
pages_dict = pages_dict or get_pages_dict()
self.add_pages_from_dict(pages_dict)
self.validation_errors = {}
+ self.openvpn_status = []
self.setPixmap(
QtGui.QWizard.BannerPixmap,
@@ -233,7 +234,7 @@ class FirstRunWizard(QtGui.QWizard):
settings.setValue("remember_user_and_pass", remember_pass)
if remember_pass:
- settings.setValue("eip_username", full_username)
+ settings.setValue("username", full_username)
seed = self.get_random_str(10)
settings.setValue("%s_seed" % provider, seed)
diff --git a/src/leap/gui/progress.py b/src/leap/gui/progress.py
index ffea80de..ca4f6cc3 100644
--- a/src/leap/gui/progress.py
+++ b/src/leap/gui/progress.py
@@ -118,11 +118,12 @@ class StepsTableWidget(QtGui.QTableWidget):
self.setSelectionMode(
QtGui.QAbstractItemView.NoSelection)
width = self.width()
+
# WTF? Here init width is 100...
# but on populating is 456... :(
+ #logger.debug('init table. width=%s' % width)
# XXX do we need this initial?
- logger.debug('init table. width=%s' % width)
self.horizontalHeader().resizeSection(0, width * 0.7)
# this disables the table grid.
@@ -286,7 +287,7 @@ class WithStepsMixIn(object):
pagename = getattr(self, 'prev_page', None)
if pagename is None: # pragma: no cover
return
- logger.debug('cleaning wizard errors for %s' % pagename)
+ #logger.debug('cleaning wizard errors for %s' % pagename)
self.wizard().set_validation_error(pagename, None)
def populateStepsTable(self):
@@ -318,7 +319,7 @@ class WithStepsMixIn(object):
table = self.stepsTableWidget
FIRST_COLUMN_PERCENT = 0.70
width = table.width()
- logger.debug('populate table. width=%s' % width)
+ #logger.debug('populate table. width=%s' % width)
table.horizontalHeader().resizeSection(0, width * FIRST_COLUMN_PERCENT)
def set_item_icon(self, img=ICON_CHECKMARK, current=True):
diff --git a/src/leap/gui/tests/test_firstrun_login.py b/src/leap/gui/tests/test_firstrun_login.py
index fa800c23..6c45b8ef 100644
--- a/src/leap/gui/tests/test_firstrun_login.py
+++ b/src/leap/gui/tests/test_firstrun_login.py
@@ -100,7 +100,7 @@ class RegisterUserPageUITestCase(qunittest.TestCase):
pages = OrderedDict((
(self.pagename, TestPage),
('providersetupvalidation',
- firstrun.regvalidation.RegisterUserValidationPage)))
+ firstrun.connect.ConnectionPage)))
self.wizard = firstrun.wizard.FirstRunWizard(None, pages_dict=pages)
self.page = self.wizard.page(self.wizard.get_page_index(self.pagename))
diff --git a/src/leap/gui/tests/test_firstrun_providerselect.py b/src/leap/gui/tests/test_firstrun_providerselect.py
index 976c68cd..18d89010 100644
--- a/src/leap/gui/tests/test_firstrun_providerselect.py
+++ b/src/leap/gui/tests/test_firstrun_providerselect.py
@@ -61,9 +61,11 @@ class SelectProviderPageLogicTestCase(qunittest.TestCase):
checks = [x for x in self.page._do_checks()]
eq(len(checks), 5)
labels = [str(x) for (x, y), z in checks]
- eq(labels, ['head_sentinel', 'checking domain name',
- 'checking https connection',
- 'fetching provider info', 'end_sentinel'])
+ eq(labels, ['head_sentinel',
+ 'Checking if it is a valid provider',
+ 'Checking for a secure connection',
+ 'Getting info from the provider',
+ 'end_sentinel'])
progress = [y for (x, y), z in checks]
eq(progress, [0, 20, 40, 80, 100])
diff --git a/src/leap/gui/tests/test_firstrun_register.py b/src/leap/gui/tests/test_firstrun_register.py
index 3447fe9d..9d62f808 100644
--- a/src/leap/gui/tests/test_firstrun_register.py
+++ b/src/leap/gui/tests/test_firstrun_register.py
@@ -78,7 +78,7 @@ class RegisterUserPageLogicTestCase(qunittest.TestCase):
eq(len(checks), 3)
labels = [str(x) for (x, y), z in checks]
eq(labels, ['head_sentinel',
- 'registering with provider',
+ 'Registering username',
'end_sentinel'])
progress = [y for (x, y), z in checks]
eq(progress, [0, 40, 100])
@@ -112,8 +112,8 @@ class RegisterUserPageUITestCase(qunittest.TestCase):
self.pagename = "signup"
pages = OrderedDict((
(self.pagename, TestPage),
- ('signupvalidation',
- firstrun.regvalidation.RegisterUserValidationPage)))
+ ('connect',
+ firstrun.connect.ConnectionPage)))
self.wizard = firstrun.wizard.FirstRunWizard(None, pages_dict=pages)
self.page = self.wizard.page(self.wizard.get_page_index(self.pagename))
diff --git a/src/leap/gui/tests/test_firstrun_wizard.py b/src/leap/gui/tests/test_firstrun_wizard.py
index 091cd932..395604d3 100644
--- a/src/leap/gui/tests/test_firstrun_wizard.py
+++ b/src/leap/gui/tests/test_firstrun_wizard.py
@@ -29,8 +29,8 @@ PAGES_DICT = dict((
('providersetupvalidation',
firstrun.providersetup.ProviderSetupValidationPage),
('signup', firstrun.register.RegisterUserPage),
- ('signupvalidation',
- firstrun.regvalidation.RegisterUserValidationPage),
+ ('connect',
+ firstrun.connect.ConnectionPage),
('lastpage', firstrun.last.LastPage)
))
@@ -94,7 +94,7 @@ class FirstRunWizardTestCase(qunittest.TestCase):
calls = [call("FirstRunWizardDone", True),
call("provider_domain", "testprovider"),
call("remember_user_and_pass", True),
- call("eip_username", "testuser@testprovider"),
+ call("username", "testuser@testprovider"),
call("testprovider_seed", RANDOMSTR)]
mqs().setValue.assert_has_calls(calls, any_order=True)
@@ -113,7 +113,7 @@ class FirstRunWizardTestCase(qunittest.TestCase):
# remember it's implemented as an ordered dict
pagenames = ('intro', 'providerselection', 'login', 'providerinfo',
- 'providersetupvalidation', 'signup', 'signupvalidation',
+ 'providersetupvalidation', 'signup', 'connect',
'lastpage')
eq = self.assertEqual
w = self.wizard