summaryrefslogtreecommitdiff
path: root/src/leap/gui/firstrun/providersetup.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/gui/firstrun/providersetup.py')
-rw-r--r--src/leap/gui/firstrun/providersetup.py55
1 files changed, 19 insertions, 36 deletions
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):