142
160
"""Create a new widget to be used."""
143
161
SSOWizardPage.__init__(self, ui, controller, parent)
163
# allow to access to the different useful data
166
"""Return the email data in the edit field."""
167
return str(self.ui.email_edit.text())
170
def email_edit(self):
171
"""Return the email edit that is used in the view."""
172
return self.ui.email_edit
176
"""Return the password data in the edit field."""
177
return str(self.ui.password_edit.text())
180
def password_edit(self):
181
"""Return the password edit used in the view."""
182
return self.ui.password_edit
185
def forgot_password_label(self):
186
"""Return the forgot password label."""
187
return self.ui.forgot_label
190
def sign_in_button(self):
191
"""Return the sign in button."""
192
return self.ui.sign_in_button
146
195
class EmailVerificationPage(SSOWizardPage):
147
196
"""Widget used to input the email verification code."""
229
299
"""Create a new instance."""
230
300
SSOWizardEnhancedEditPage.__init__(self, ui, controller, parent)
303
def reset_code_line_edit(self):
304
"""Return the line edit where the reset code is given."""
305
return self.ui.reset_code_line_edit
308
def reset_code(self):
309
"""Return the reset code typed by the user."""
310
return str(self.ui.reset_code_line_edit.text())
313
def password_line_edit(self):
314
"""Return the line edit where the password is typed."""
315
return self.ui.password_line_edit
319
"""Return the passsword typed by the user."""
320
return str(self.ui.password_line_edit.text())
323
def confirm_password_line_edit(self):
324
"""Return the line edit used to confirm the password."""
325
return self.ui.confirm_password_line_edit
328
def retyped_password(self):
329
"""Return the password confirmation given by the user."""
330
return str(self.ui.confirm_password_line_edit.text())
333
def reset_password_button(self):
334
"""Return the button used to reset the password."""
335
return self.ui.reset_password_button
233
338
class TosPage(SSOWizardPage):
234
339
"""Widget used to show the tos."""
245
355
"""Create a new widget to be used."""
246
356
SSOWizardEnhancedEditPage.__init__(self, ui, controller, parent)
247
357
self._enhanced_edits = {}
248
# palettes that will be used to set the colors of the password strengh
359
self.ui.setupUi(self)
360
# palettes that will be used to set the colors of the password strength
361
original_palette = self.ui.strength_frame.palette()
362
self._original_color = original_palette.background().color()
249
363
self.captcha_id = None
250
364
self.captcha_file = None
251
365
self.ui.captcha_view.setPixmap(QPixmap())
366
self.controller = controller
367
self.controller.setupUi(self)
369
def set_strength_level(self, level, password):
370
"""Set the strength level colors."""
374
self._set_frame_color(self.ui.weak_frame, WEAK_COLOR)
375
self._set_frame_color(self.ui.medium_frame,
376
self._original_color)
377
self._set_frame_color(self.ui.strong_frame,
378
self._original_color)
381
self._set_frame_color(self.ui.weak_frame, MEDIUM_COLOR)
382
self._set_frame_color(self.ui.medium_frame, MEDIUM_COLOR)
383
self._set_frame_color(self.ui.strong_frame,
384
self._original_color)
387
self._set_frame_color(self.ui.weak_frame, STRONG_COLOR)
388
self._set_frame_color(self.ui.medium_frame, STRONG_COLOR)
389
self._set_frame_color(self.ui.strong_frame, STRONG_COLOR)
391
# set it to the minimum
392
self._set_frame_color(self.ui.weak_frame, self._original_color)
393
self._set_frame_color(self.ui.medium_frame, self._original_color)
394
self._set_frame_color(self.ui.strong_frame, self._original_color)
396
def _set_frame_color(self, frame, color):
397
"""Set the color of a frame to indicated a strength."""
398
# change the color background for the given frame
399
palette = frame.palette()
400
palette.setColor(QPalette.Background, color)
401
frame.setPalette(palette)
402
frame.setAutoFillBackground(True)
406
"""Return the name input."""
407
return str(self.ui.first_name_edit.text())
411
"""Return the edit used for the name."""
412
return self.ui.first_name_edit
416
"""Return the last name input."""
417
return str(self.ui.last_name_edit.text())
420
def last_name_edit(self):
421
"""Return the edit used for the last name."""
422
return self.ui.last_name_edit
426
"""Return the email input."""
427
return str(self.ui.email_edit.text())
430
def email_edit(self):
431
"""Return the edit used for the email."""
432
return self.ui.email_edit
435
def retyped_email(self):
436
"""Return the retyped email."""
437
return str(self.ui.confirm_email_edit.text())
440
def confirm_email_edit(self):
441
"""Return the edit used for the retype of the email."""
442
return self.ui.confirm_email_edit
445
def password_info_label(self):
446
"""Return the password used to show the info of the label."""
447
return self.ui.password_info_label
451
"""Return the password data."""
452
return str(self.ui.password_edit.text())
455
def password_edit(self):
456
"""Return the edit used for the password."""
457
return self.ui.password_edit
460
def retyped_password(self):
461
"""Return the retyped password."""
462
return str(self.ui.confirm_password_edit.text())
465
def confirm_password_edit(self):
466
"""Return the edit used to confirm the password."""
467
return self.ui.confirm_password_edit
470
def captcha_refresh_label(self):
471
"""Return the refresh label."""
472
return self.ui.refresh_label
475
def captcha_solution(self):
476
"""Return the provided captcha solution."""
477
return str(self.ui.captcha_solution_edit.text())
480
def captcha_solution_edit(self):
481
"""Return the edit used for the captcha solution."""
482
return self.ui.captcha_solution_edit
253
484
def get_captcha_image(self):
254
485
"""Return the path to the captcha image."""
262
493
captcha_image = property(get_captcha_image, set_captcha_image)
496
def terms_and_conditions_agreed(self):
497
"""Return if the user agreed the terms."""
498
return self.ui.terms_checkbox.isChecked()
501
def terms_and_conditions_check_box(self):
502
"""Return the terms and codition item."""
503
return self.ui.terms_checkbox
506
def terms_and_conditions_button(self):
507
"""Return the terms and conditions button."""
508
return self.ui.terms_button
511
def set_up_button(self):
512
"""Return the set up button."""
513
return self.ui.set_up_button
265
516
class SuccessPage(SSOWizardPage):
266
517
"""Page used to display success message."""