From ad16a72f60ecc84524c22e8912df4eb8a48a2a42 Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 6 Nov 2012 16:26:10 +0900 Subject: split wizard into separate files so we don't go nuts yet. --- src/leap/gui/firstrun/providersetup.py | 122 +++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/leap/gui/firstrun/providersetup.py (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py new file mode 100644 index 00000000..63f55d00 --- /dev/null +++ b/src/leap/gui/firstrun/providersetup.py @@ -0,0 +1,122 @@ +""" +Provider Setup Validation Page, +used if First Run Wizard +""" + +from PyQt4 import QtGui + +from leap.gui.progress import ValidationPage + +from leap.gui.constants import APP_LOGO + + +class ProviderSetupValidationPage(ValidationPage): + def __init__(self, parent=None): + super(ProviderSetupValidationPage, self).__init__(parent) + self.setTitle("Setting up provider") + #self.setSubTitle( + #"auto configuring provider...") + + self.setPixmap( + QtGui.QWizard.LogoPixmap, + QtGui.QPixmap(APP_LOGO)) + + def _do_checks(self, signal=None): + """ + executes actual checks in a separate thread + """ + import time + domain = self.field('provider_domain') + wizard = self.wizard() + pconfig = wizard.providerconfig + + pCertChecker = wizard.providercertchecker + certchecker = pCertChecker(domain=domain) + + signal.emit('Fetching CA certificate') + self.progress.setValue(30) + + if pconfig: + ca_cert_uri = pconfig.get('ca_cert_uri').geturl() + else: + ca_cert_uri = None + + # XXX check scheme == "https" + # XXX passing verify == False because + # we have trusted right before. + # We should check it's the same domain!!! + # (Check with the trusted fingerprints dict + # or something smart) + + #certchecker.download_ca_cert( + #uri=ca_cert_uri, + #verify=False) + + time.sleep(2) + + signal.emit('Checking CA fingerprint') + self.progress.setValue(66) + #ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None) + + # XXX get fingerprint dict (types) + #sha256_fpr = ca_cert_fingerprint.split('=')[1] + + #validate_fpr = certchecker.check_ca_cert_fingerprint( + #fingerprint=sha256_fpr) + time.sleep(0.5) + #if not validate_fpr: + # XXX update validationMsg + # should catch exception + #return False + + signal.emit('Validating api certificate') + self.progress.setValue(90) + + #api_uri = pconfig.get('api_uri', None) + #try: + #api_cert_verified = certchecker.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 + time.sleep(0.5) + #ca_cert_path = checker.ca_cert_path + + self.progress.setValue(100) + signal.emit('end_sentinel') + time.sleep(1) + + def _do_validation(self): + """ + called after _do_checks has finished + (connected to checker thread finished signal) + """ + wizard = self.wizard() + if self.errors: + print 'going back with errors' + wizard.set_validation_error( + 'signup', 'that name is taken') + self.go_back() + else: + print 'going next' + self.go_next() + + def nextId(self): + wizard = self.wizard() + if not wizard: + return + is_signup = self.field('is_signup') + if is_signup is True: + next_ = 'signup' + if is_signup is False: + next_ = 'connecting' + return wizard.get_page_index(next_) -- cgit v1.2.3 From 6032f776cabcd04aa7f4e1f55a34ecfec2775e85 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 7 Nov 2012 04:48:12 +0900 Subject: changes to update_signal + Fix update + Rename + Changed signature (we update progress bar from slot now) --- src/leap/gui/firstrun/providersetup.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 63f55d00..c039dfc5 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -21,7 +21,7 @@ class ProviderSetupValidationPage(ValidationPage): QtGui.QWizard.LogoPixmap, QtGui.QPixmap(APP_LOGO)) - def _do_checks(self, signal=None): + def _do_checks(self, update_signal=None): """ executes actual checks in a separate thread """ @@ -33,8 +33,7 @@ class ProviderSetupValidationPage(ValidationPage): pCertChecker = wizard.providercertchecker certchecker = pCertChecker(domain=domain) - signal.emit('Fetching CA certificate') - self.progress.setValue(30) + update_signal.emit('Fetching CA certificate', 30) if pconfig: ca_cert_uri = pconfig.get('ca_cert_uri').geturl() @@ -54,8 +53,7 @@ class ProviderSetupValidationPage(ValidationPage): time.sleep(2) - signal.emit('Checking CA fingerprint') - self.progress.setValue(66) + update_signal.emit('Checking CA fingerprint', 66) #ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None) # XXX get fingerprint dict (types) @@ -69,8 +67,7 @@ class ProviderSetupValidationPage(ValidationPage): # should catch exception #return False - signal.emit('Validating api certificate') - self.progress.setValue(90) + update_signal.emit('Validating api certificate', 90) #api_uri = pconfig.get('api_uri', None) #try: @@ -91,8 +88,7 @@ class ProviderSetupValidationPage(ValidationPage): time.sleep(0.5) #ca_cert_path = checker.ca_cert_path - self.progress.setValue(100) - signal.emit('end_sentinel') + update_signal.emit('end_sentinel', 100) time.sleep(1) def _do_validation(self): -- cgit v1.2.3 From b84007d8fec8c949ba4ac1d26695c710a210d797 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 8 Nov 2012 08:37:24 +0900 Subject: more careful error catching during registration. added a twisted server that fakes some of the provider interaction. --- src/leap/gui/firstrun/providersetup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index c039dfc5..2609629a 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -100,7 +100,8 @@ class ProviderSetupValidationPage(ValidationPage): if self.errors: print 'going back with errors' wizard.set_validation_error( - 'signup', 'that name is taken') + 'providerselection', + 'error on provider setup') self.go_back() else: print 'going next' -- cgit v1.2.3 From 6dac344ee1826f9413a40c7783517bc640f826ca Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 12 Nov 2012 22:09:05 +0900 Subject: uncomment download_ca_cert call --- src/leap/gui/firstrun/providersetup.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 2609629a..a1710a3a 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -7,7 +7,7 @@ from PyQt4 import QtGui from leap.gui.progress import ValidationPage -from leap.gui.constants import APP_LOGO +from leap.gui.constants import APP_LOGO, pause_for_user class ProviderSetupValidationPage(ValidationPage): @@ -25,7 +25,6 @@ class ProviderSetupValidationPage(ValidationPage): """ executes actual checks in a separate thread """ - import time domain = self.field('provider_domain') wizard = self.wizard() pconfig = wizard.providerconfig @@ -33,7 +32,9 @@ class ProviderSetupValidationPage(ValidationPage): pCertChecker = wizard.providercertchecker certchecker = pCertChecker(domain=domain) + update_signal.emit('head_sentinel', 0) update_signal.emit('Fetching CA certificate', 30) + pause_for_user() if pconfig: ca_cert_uri = pconfig.get('ca_cert_uri').geturl() @@ -47,11 +48,10 @@ class ProviderSetupValidationPage(ValidationPage): # (Check with the trusted fingerprints dict # or something smart) - #certchecker.download_ca_cert( - #uri=ca_cert_uri, - #verify=False) - - time.sleep(2) + certchecker.download_ca_cert( + uri=ca_cert_uri, + verify=False) + pause_for_user() update_signal.emit('Checking CA fingerprint', 66) #ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None) @@ -61,7 +61,6 @@ class ProviderSetupValidationPage(ValidationPage): #validate_fpr = certchecker.check_ca_cert_fingerprint( #fingerprint=sha256_fpr) - time.sleep(0.5) #if not validate_fpr: # XXX update validationMsg # should catch exception @@ -85,11 +84,11 @@ class ProviderSetupValidationPage(ValidationPage): # XXX update validationMsg # should catch exception #return False - time.sleep(0.5) + pause_for_user() #ca_cert_path = checker.ca_cert_path update_signal.emit('end_sentinel', 100) - time.sleep(1) + pause_for_user() def _do_validation(self): """ -- cgit v1.2.3 From 971c5e2217d17f4dab68336c9d8f562ca63fc84b Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 13 Nov 2012 00:14:53 +0900 Subject: check credentials on login branch plus fix repaint on populateErrors on login page, should refactor to ToBeValidated class or something similar, with the other paintEvent functions that implement the painting of errors coming from the "next" validating page. --- src/leap/gui/firstrun/providersetup.py | 75 +++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 11 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index a1710a3a..3fb9a19b 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -2,17 +2,24 @@ Provider Setup Validation Page, used if First Run Wizard """ +import logging from PyQt4 import QtGui +from leap.base import auth from leap.gui.progress import ValidationPage from leap.gui.constants import APP_LOGO, pause_for_user +logger = logging.getLogger(__name__) + class ProviderSetupValidationPage(ValidationPage): def __init__(self, parent=None): super(ProviderSetupValidationPage, self).__init__(parent) + is_signup = self.field("is_signup") + self.is_signup = is_signup + self.setTitle("Setting up provider") #self.setSubTitle( #"auto configuring provider...") @@ -25,14 +32,56 @@ class ProviderSetupValidationPage(ValidationPage): """ executes actual checks in a separate thread """ - domain = self.field('provider_domain') + full_domain = self.field('provider_domain') wizard = self.wizard() pconfig = wizard.providerconfig - pCertChecker = wizard.providercertchecker - certchecker = pCertChecker(domain=domain) + #pCertChecker = wizard.providercertchecker + #certchecker = pCertChecker(domain=full_domain) + pCertChecker = wizard.providercertchecker( + domain=full_domain) update_signal.emit('head_sentinel', 0) + + ###################################### + if not self.is_signup: + # We come from login page. + # We try a call to an authenticated + # page here as a mean to catch + # srp authentication errors while + # we are still at one page's reach + # of the login credentials input page. + # (so we're able to go back an correct) + + step = "fetch_eipcert" + update_signal.emit('validating credentials', 20) + + unamek = 'login_userName' + passwk = 'login_userPassword' + + username = self.field(unamek) + password = self.field(passwk) + credentials = username, password + + ################# + # FIXME #BUG #638 + verify = False + + try: + pCertChecker.download_new_client_cert( + credentials=credentials, + verify=verify) + + except auth.SRPAuthenticationError as exc: + self.set_error( + step, + "Authentication error: %s" % exc.message) + return False + + pause_for_user() + + ####################################### + update_signal.emit('Fetching CA certificate', 30) pause_for_user() @@ -48,7 +97,7 @@ class ProviderSetupValidationPage(ValidationPage): # (Check with the trusted fingerprints dict # or something smart) - certchecker.download_ca_cert( + pCertChecker.download_ca_cert( uri=ca_cert_uri, verify=False) pause_for_user() @@ -59,7 +108,7 @@ class ProviderSetupValidationPage(ValidationPage): # XXX get fingerprint dict (types) #sha256_fpr = ca_cert_fingerprint.split('=')[1] - #validate_fpr = certchecker.check_ca_cert_fingerprint( + #validate_fpr = pCertChecker.check_ca_cert_fingerprint( #fingerprint=sha256_fpr) #if not validate_fpr: # XXX update validationMsg @@ -70,7 +119,7 @@ class ProviderSetupValidationPage(ValidationPage): #api_uri = pconfig.get('api_uri', None) #try: - #api_cert_verified = certchecker.verify_api_https(api_uri) + #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 @@ -95,15 +144,18 @@ 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() + if self.errors: - print 'going back with errors' + logger.debug('going back with errors') + name, first_error = self.pop_first_error() wizard.set_validation_error( - 'providerselection', - 'error on provider setup') + prevpage, + first_error) self.go_back() else: - print 'going next' + logger.debug('going next') self.go_next() def nextId(self): @@ -114,5 +166,6 @@ class ProviderSetupValidationPage(ValidationPage): if is_signup is True: next_ = 'signup' if is_signup is False: - next_ = 'connecting' + # XXX bad name. change to connect again. + next_ = 'signupvalidation' return wizard.get_page_index(next_) -- cgit v1.2.3 From 4153bee65d2541b99d4e41aaaf2fd6b2b71b2cc3 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 19 Nov 2012 23:15:36 +0900 Subject: disable "next" button during validation and wait for user to click it. Closes #973 --- src/leap/gui/firstrun/providersetup.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 3fb9a19b..5b50db87 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -78,12 +78,12 @@ class ProviderSetupValidationPage(ValidationPage): "Authentication error: %s" % exc.message) return False - pause_for_user() + #pause_for_user() ####################################### update_signal.emit('Fetching CA certificate', 30) - pause_for_user() + #pause_for_user() if pconfig: ca_cert_uri = pconfig.get('ca_cert_uri').geturl() @@ -100,7 +100,7 @@ class ProviderSetupValidationPage(ValidationPage): pCertChecker.download_ca_cert( uri=ca_cert_uri, verify=False) - pause_for_user() + #pause_for_user() update_signal.emit('Checking CA fingerprint', 66) #ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None) @@ -133,11 +133,13 @@ class ProviderSetupValidationPage(ValidationPage): # XXX update validationMsg # should catch exception #return False - pause_for_user() + + #pause_for_user() #ca_cert_path = checker.ca_cert_path + self.set_done() update_signal.emit('end_sentinel', 100) - pause_for_user() + #pause_for_user() def _do_validation(self): """ @@ -153,10 +155,11 @@ class ProviderSetupValidationPage(ValidationPage): wizard.set_validation_error( prevpage, first_error) - self.go_back() + # XXX don't go back, signal error + #self.go_back() else: - logger.debug('going next') - self.go_next() + logger.debug('should be going next, wait on user') + #self.go_next() def nextId(self): wizard = self.wizard() -- cgit v1.2.3 From a91001e9b84896e8df10ab13aad2dbccd3b6cf36 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 19 Nov 2012 23:34:03 +0900 Subject: add domain name to providerinfo page --- src/leap/gui/firstrun/providersetup.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 5b50db87..0f0bdbd0 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -172,3 +172,8 @@ class ProviderSetupValidationPage(ValidationPage): # XXX bad name. change to connect again. next_ = 'signupvalidation' return wizard.get_page_index(next_) + + def initializePage(self): + super(ProviderSetupValidationPage, self).initializePage() + self.set_undone() + self.completeChanged.emit() -- cgit v1.2.3 From 7dceb11bcd4cf552938ccfa02daaf6f902ef385b Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 21 Nov 2012 05:15:06 +0900 Subject: tango icons for checking/checked/failed check status --- src/leap/gui/firstrun/providersetup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 0f0bdbd0..7c19dc3f 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -54,7 +54,7 @@ class ProviderSetupValidationPage(ValidationPage): # (so we're able to go back an correct) step = "fetch_eipcert" - update_signal.emit('validating credentials', 20) + update_signal.emit('Validating credentials', 20) unamek = 'login_userName' passwk = 'login_userPassword' -- cgit v1.2.3 From f9a3e2cf6c4f7398411788974a2a6a9a53c9a1ab Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 22 Nov 2012 02:46:57 +0900 Subject: info page refactor. --- src/leap/gui/firstrun/providersetup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 7c19dc3f..042d117c 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -20,9 +20,9 @@ class ProviderSetupValidationPage(ValidationPage): is_signup = self.field("is_signup") self.is_signup = is_signup - self.setTitle("Setting up provider") - #self.setSubTitle( - #"auto configuring provider...") + self.setTitle("Provider setup") + self.setSubTitle( + "Doing autoconfig.") self.setPixmap( QtGui.QWizard.LogoPixmap, -- cgit v1.2.3 From 7a263b8ee74cc92ba39796cd9ad48395adfa7450 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 23 Nov 2012 05:13:36 +0900 Subject: refactor validation mixin; progress until register page --- src/leap/gui/firstrun/providersetup.py | 158 ++++++++++++++++----------------- 1 file changed, 78 insertions(+), 80 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 042d117c..7904538d 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -6,10 +6,10 @@ import logging from PyQt4 import QtGui -from leap.base import auth +from leap.base import exceptions as baseexceptions from leap.gui.progress import ValidationPage -from leap.gui.constants import APP_LOGO, pause_for_user +from leap.gui.constants import APP_LOGO logger = logging.getLogger(__name__) @@ -20,18 +20,21 @@ class ProviderSetupValidationPage(ValidationPage): is_signup = self.field("is_signup") self.is_signup = is_signup - self.setTitle("Provider setup") + self.setTitle(self.tr("Provider setup")) self.setSubTitle( - "Doing autoconfig.") + self.tr("Doing autoconfig.")) self.setPixmap( QtGui.QWizard.LogoPixmap, QtGui.QPixmap(APP_LOGO)) - def _do_checks(self, update_signal=None): + def _do_checks(self): """ - executes actual checks in a separate thread + generator that yields actual checks + that are executed in a separate thread """ + curpage = "providersetupvalidation" + full_domain = self.field('provider_domain') wizard = self.wizard() pconfig = wizard.providerconfig @@ -41,68 +44,56 @@ class ProviderSetupValidationPage(ValidationPage): pCertChecker = wizard.providercertchecker( domain=full_domain) - update_signal.emit('head_sentinel', 0) - - ###################################### - if not self.is_signup: - # We come from login page. - # We try a call to an authenticated - # page here as a mean to catch - # srp authentication errors while - # we are still at one page's reach - # of the login credentials input page. - # (so we're able to go back an correct) + def fail(): + self.is_done = False + return False - step = "fetch_eipcert" - update_signal.emit('Validating credentials', 20) + yield(("head_sentinel", 0), lambda: None) - unamek = 'login_userName' - passwk = 'login_userPassword' + ######################## + # 1) fetch ca cert + ######################## - username = self.field(unamek) - password = self.field(passwk) - credentials = username, password - - ################# - # FIXME #BUG #638 - verify = False + def fetchcacert(): + if pconfig: + ca_cert_uri = pconfig.get('ca_cert_uri').geturl() + else: + ca_cert_uri = None + # XXX check scheme == "https" + # XXX passing verify == False because + # we have trusted right before. + # We should check it's the same domain!!! + # (Check with the trusted fingerprints dict + # or something smart) try: - pCertChecker.download_new_client_cert( - credentials=credentials, - verify=verify) + pCertChecker.download_ca_cert( + uri=ca_cert_uri, + verify=False) - except auth.SRPAuthenticationError as exc: - self.set_error( - step, - "Authentication error: %s" % exc.message) - return False + except baseexceptions.LeapException as exc: + logger.error(exc.message) + wizard.set_validation_error( + curpage, exc.usermessage) + return fail() - #pause_for_user() + except Exception as exc: + wizard.set_validation_error( + curpage, exc.message) + return fail() - ####################################### + else: + return True - update_signal.emit('Fetching CA certificate', 30) - #pause_for_user() + yield(('Fetching CA certificate', 30), fetchcacert) - if pconfig: - ca_cert_uri = pconfig.get('ca_cert_uri').geturl() - else: - ca_cert_uri = None + ######################### + # 2) check CA fingerprint + ######################### - # XXX check scheme == "https" - # XXX passing verify == False because - # we have trusted right before. - # We should check it's the same domain!!! - # (Check with the trusted fingerprints dict - # or something smart) - - pCertChecker.download_ca_cert( - uri=ca_cert_uri, - verify=False) - #pause_for_user() - - update_signal.emit('Checking CA fingerprint', 66) + def checkcafingerprint(): + # XXX get the real thing!!! + pass #ca_cert_fingerprint = pconfig.get('ca_cert_fingerprint', None) # XXX get fingerprint dict (types) @@ -115,33 +106,40 @@ class ProviderSetupValidationPage(ValidationPage): # should catch exception #return False - update_signal.emit('Validating api certificate', 90) - - #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 + yield((self.tr("Checking CA fingerprint"), 60), checkcafingerprint) + + ######################### + # 2) check CA fingerprint + ######################### + + 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 - #pause_for_user() - #ca_cert_path = checker.ca_cert_path + yield((self.tr('Validating api certificate'), 90), validatecacert) self.set_done() - update_signal.emit('end_sentinel', 100) - #pause_for_user() + yield(('end_sentinel', 100), lambda: None) - def _do_validation(self): + def on_checks_validation_ready(self): """ called after _do_checks has finished (connected to checker thread finished signal) -- cgit v1.2.3 From d5136a5f3b2aa8b16e8341f2eb99d05993028acf Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 27 Nov 2012 00:12:22 +0900 Subject: inline validation at register page. inline widget and focus and red marks and whistles. --- src/leap/gui/firstrun/providersetup.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 7904538d..1a362794 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -17,6 +17,9 @@ logger = logging.getLogger(__name__) class ProviderSetupValidationPage(ValidationPage): def __init__(self, parent=None): super(ProviderSetupValidationPage, self).__init__(parent) + self.current_page = "providersetupvalidation" + + # XXX needed anymore? is_signup = self.field("is_signup") self.is_signup = is_signup @@ -33,7 +36,6 @@ class ProviderSetupValidationPage(ValidationPage): generator that yields actual checks that are executed in a separate thread """ - curpage = "providersetupvalidation" full_domain = self.field('provider_domain') wizard = self.wizard() @@ -44,10 +46,6 @@ class ProviderSetupValidationPage(ValidationPage): pCertChecker = wizard.providercertchecker( domain=full_domain) - def fail(): - self.is_done = False - return False - yield(("head_sentinel", 0), lambda: None) ######################## @@ -73,19 +71,17 @@ class ProviderSetupValidationPage(ValidationPage): except baseexceptions.LeapException as exc: logger.error(exc.message) - wizard.set_validation_error( - curpage, exc.usermessage) - return fail() + # XXX this should be _ method + return self.fail(self.tr(exc.usermessage)) except Exception as exc: - wizard.set_validation_error( - curpage, exc.message) - return fail() + return self.fail(exc.message) else: return True - yield(('Fetching CA certificate', 30), fetchcacert) + yield((self.tr('Fetching CA certificate'), 30), + fetchcacert) ######################### # 2) check CA fingerprint @@ -106,7 +102,8 @@ class ProviderSetupValidationPage(ValidationPage): # should catch exception #return False - yield((self.tr("Checking CA fingerprint"), 60), checkcafingerprint) + yield((self.tr("Checking CA fingerprint"), 60), + checkcafingerprint) ######################### # 2) check CA fingerprint -- cgit v1.2.3 From f55dcd717a946651492142ed198853b1c667254b Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 10 Jan 2013 02:00:21 +0900 Subject: renamed connection page --- src/leap/gui/firstrun/providersetup.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 1a362794..48a89091 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -20,8 +20,8 @@ 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( @@ -158,14 +158,12 @@ class ProviderSetupValidationPage(ValidationPage): def nextId(self): wizard = self.wizard() - if not wizard: - return - is_signup = self.field('is_signup') - if is_signup is True: - next_ = 'signup' - if is_signup is False: + from_login = wizard.from_login + if from_login: # XXX bad name. change to connect again. next_ = 'signupvalidation' + else: + next_ = 'signup' return wizard.get_page_index(next_) def initializePage(self): -- cgit v1.2.3 From 6d85c97ddcc8a151b157919e9a7322fba151a551 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 11 Jan 2013 03:00:41 +0900 Subject: all calls except the first one are made to api uri we also parse the port number --- src/leap/gui/firstrun/providersetup.py | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 48a89091..981e3214 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 @@ -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') -- cgit v1.2.3 From 407b030bb7d27b797fb27254710a358c9c69f8be Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 24 Jan 2013 01:57:28 +0900 Subject: catch missing messages on last page of wizard --- src/leap/gui/firstrun/providersetup.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 981e3214..6017e4d3 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -141,18 +141,12 @@ 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() from_login = wizard.from_login if from_login: - # XXX bad name. change to connect again. - next_ = 'signupvalidation' + next_ = 'connect' else: next_ = 'signup' return wizard.get_page_index(next_) -- cgit v1.2.3 From ff59da55ef9a176b36cef19d67e7ec363bf5d739 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 24 Jan 2013 02:30:00 +0900 Subject: wizard rephrasing & punctuation --- src/leap/gui/firstrun/providersetup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/gui/firstrun/providersetup.py') diff --git a/src/leap/gui/firstrun/providersetup.py b/src/leap/gui/firstrun/providersetup.py index 6017e4d3..47060f6e 100644 --- a/src/leap/gui/firstrun/providersetup.py +++ b/src/leap/gui/firstrun/providersetup.py @@ -27,7 +27,7 @@ class ProviderSetupValidationPage(ValidationPage): 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, -- cgit v1.2.3