~alecu/ubuntu-sso-client/timestamp-autofix-1-4

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/controllers.py

  • Committer: Tarmac
  • Author(s): Diego Sarmentero
  • Date: 2011-08-17 12:31:33 UTC
  • mfrom: (758.1.1 ubuntu-sso-client)
  • Revision ID: tarmac-20110817123133-cs1fxv77mxlghlle
Show Form Errors at the bottom of each Page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
        # let the user know
223
223
        logger.error('Got error when login %s, error: %s',
224
224
                     self.view.wizard().app_name, error)
225
 
        self.message_box.critical(self.view, self.view.wizard().app_name,
226
 
                                  error['message'])
 
225
        self.message_box.critical(error['message'])
227
226
 
228
227
    def on_logged_in(self, app_name, result):
229
228
        """We managed to log in."""
399
398
    def on_captcha_generation_error(self, error):
400
399
        """An error ocurred."""
401
400
        logger.debug('SetUpAccountController.on_captcha_generation_error')
402
 
        self.message_box.critical(self.view, self.view.wizard().app_name,
403
 
            CAPTCHA_LOAD_ERROR)
 
401
        self.message_box.critical(CAPTCHA_LOAD_ERROR)
404
402
 
405
403
    def on_user_registration_error(self, app_name, error):
406
404
        """Let the user know we could not register."""
408
406
        # errors are returned as a dict with the data we want to show.
409
407
        self._refresh_captcha()
410
408
        errors = [v for _, v in sorted(error.iteritems())]
411
 
        self.message_box.critical(
412
 
            self.view,
413
 
            self.view.wizard().app_name,
414
 
            '\n'.join(errors))
 
409
        self.message_box.critical('\n'.join(errors))
415
410
 
416
411
    def on_user_registered(self, app_name, result):
417
412
        """Execute when the user did register."""
434
429
        confirm_password = unicode(self.view.ui.confirm_password_edit.text())
435
430
        captcha_solution = unicode(self.view.ui.captcha_solution_edit.text())
436
431
        if not is_correct_email(email):
437
 
            self.message_box.critical(self.view, self.view.wizard().app_name,
438
 
                EMAIL_INVALID)
 
432
            self.message_box.critical(EMAIL_INVALID)
439
433
        if email != confirm_email:
440
 
            self.message_box.critical(self.view, self.view.wizard().app_name,
441
 
                EMAIL_MISMATCH)
 
434
            self.message_box.critical(EMAIL_MISMATCH)
442
435
            return False
443
436
        if not is_min_required_password(password):
444
 
            self.message_box.critical(self.view, self.view.wizard().app_name,
445
 
                PASSWORD_TOO_WEAK)
 
437
            self.message_box.critical(PASSWORD_TOO_WEAK)
446
438
            return False
447
439
        if password != confirm_password:
448
 
            self.message_box.critical(self.view, self.view.wizard().app_name,
449
 
                PASSWORD_MISMATCH)
 
440
            self.message_box.critical(PASSWORD_MISMATCH)
450
441
            return False
451
442
        if not captcha_solution:
452
 
            self.message_box.critical(self.view, self.view.wizard().app_name,
453
 
                CAPTCHA_REQUIRED_ERROR)
 
443
            self.message_box.critical(CAPTCHA_REQUIRED_ERROR)
454
444
            return False
455
445
        return True
456
446
 
601
591
        msg = error.get('email_token')
602
592
        if msg is None:
603
593
            msg = '\n'.join([v for _, v in sorted(error.iteritems())])
604
 
        self.message_box.critical(self.view, app_name, msg)
 
594
        self.message_box.critical(msg)
605
595
 
606
596
    #pylint: disable=C0103
607
597
    def pageInitialized(self):