30
31
gettext.textdomain('ubuntu-sso-client')
31
32
_ = gettext.gettext
34
# all the text that is used in the gui
35
CAPTCHA_SOLUTION_ENTRY = _('Type the characters above')
36
CAPTCHA_LOAD_ERROR = _('There was a problem getting the captcha, '
38
CONNECT_HELP_LABEL = _('To connect this computer to %(app_name)s ' \
39
'enter your details below.')
40
EMAIL1_ENTRY = _('Email address')
41
EMAIL2_ENTRY = _('Re-type Email address')
42
EMAIL_MISMATCH = _('The email addresses don\'t match, please double check '
43
'and try entering them again.')
44
EMAIL_INVALID = _('The email must be a valid email address.')
45
EMAIL_TOKEN_ENTRY = _('Enter code verification here')
46
ERROR = _('The process did not finish successfully.')
47
EXISTING_ACCOUNT_CHOICE_BUTTON = _('Sign me in with my existing account')
48
FIELD_REQUIRED = _('This field is required.')
49
FORGOTTEN_PASSWORD_BUTTON = _('I\'ve forgotten my password')
50
JOIN_HEADER_LABEL = _('Create %(app_name)s account')
51
LOADING = _('Loading...')
52
LOGIN_BUTTON_LABEL = _('Already have an account? Click here to sign in')
53
LOGIN_EMAIL_ENTRY = _('Email address')
54
LOGIN_HEADER_LABEL = _('Connect to %(app_name)s')
55
LOGIN_PASSWORD_ENTRY = _('Password')
56
NAME_ENTRY = _('Name')
58
ONE_MOMENT_PLEASE = _('One moment please...')
59
PASSWORD_CHANGED = _('Your password was successfully changed.')
60
PASSWORD1_ENTRY = RESET_PASSWORD1_ENTRY = _('Password')
61
PASSWORD2_ENTRY = RESET_PASSWORD2_ENTRY = _('Re-type Password')
62
PASSWORD_HELP = _('The password must have a minimum of 8 characters and ' \
63
'include one uppercase character and one number.')
64
PASSWORD_MISMATCH = _('The passwords don\'t match, please double check ' \
65
'and try entering them again.')
66
PASSWORD_TOO_WEAK = _('The password is too weak.')
67
REQUEST_PASSWORD_TOKEN_LABEL = _('To reset your %(app_name)s password,'
68
' enter your email address below:')
69
RESET_PASSWORD = _('Reset password')
70
RESET_CODE_ENTRY = _('Reset code')
71
RESET_EMAIL_ENTRY = _('Email address')
72
SET_NEW_PASSWORD_LABEL = _('A password reset code has been sent to ' \
73
'%(email)s.\nPlease enter the code below ' \
74
'along with your new password.')
75
SET_UP_ACCOUNT_CHOICE_BUTTON = _('I don\'t have an account yet - sign me up')
76
SET_UP_ACCOUNT_BUTTON = _('Set up Account')
77
SIGN_IN_BUTTON = _('Sign In')
78
SUCCESS = _('The process finished successfully. Congratulations!')
79
SURNAME_ENTRY = _('Surname')
80
TC_BUTTON = _('Show Terms & Conditions')
81
TC_NOT_ACCEPTED = _('Agreeing to the Ubuntu One Terms & Conditions is ' \
82
'required to subscribe.')
83
UNKNOWN_ERROR = _('There was an error when trying to complete the ' \
84
'process. Please check the information and try again.')
85
VERIFY_EMAIL_TITLE = _('Enter verification code')
86
VERIFY_EMAIL_CONTENT = _('Check %(email)s for an email from'
87
' Ubuntu Single Sign On.'
88
' This message contains a verification code.'
89
' Enter the code in the field below and click OK'
90
' to complete creating your %(app_name)s account')
91
VERIFY_EMAIL_LABEL = ('<b>%s</b>\n\n' % VERIFY_EMAIL_TITLE +
93
YES_TO_TC = _('I agree with the %(app_name)s terms and conditions')
94
YES_TO_UPDATES = _('Yes! Email me %(app_name)s tips and updates.')
95
CAPTCHA_RELOAD_TOOLTIP = _('Reload')
34
98
def get_data_dir():
35
99
"""Build absolute path to the 'data' directory."""
61
125
def get_data_file(*args):
62
126
"""Build absolute path to the path within the 'data' directory."""
63
127
return os.path.join(get_data_dir(), *args)
130
def get_password_strength(password):
131
"""Return the strenght of the password.
133
This function returns the strenght of the password so that ui elements
134
can show the user how good his password is. The logic used is the
137
* 1 extra point for 4 chars passwords
138
* 1 extra point for 8 chars passwords
139
* 1 extra point for more than 11 chars passwords.
140
* 1 extra point for passwords with at least one number.
141
* 1 extra point for passwords for lower and capital chars.
142
* 1 extra point for passwords with a special char.
144
A passwords starts with 0 and the extra points are added accordingly.
147
if len(password) < 1:
149
if len(password) < 4:
151
if len(password) >= 8:
153
if len(password) >= 11:
155
if re.search('\d+', password):
157
if re.search('[a-z]', password) and re.search('[A-Z]', password):
159
if re.search('.[!,@,#,$,%,^,&,*,?,_,~,-,£,(,)]', password):
164
def is_min_required_password(password):
165
"""Return if the password meets the minimum requirements."""
166
if (len(password) < 8 or
167
re.search('[A-Z]', password) is None or
168
re.search('\d+', password) is None):