Merge lp:~wgrant/launchpad/purge-more-password into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 14725
Proposed branch: lp:~wgrant/launchpad/purge-more-password
Merge into: lp:launchpad
Diff against target: 153 lines (+0/-68)
3 files modified
lib/lp/app/validators/validation.py (+0/-33)
lib/lp/services/fields/__init__.py (+0/-20)
lib/lp/services/verification/interfaces/authtoken.py (+0/-15)
To merge this branch: bzr merge lp:~wgrant/launchpad/purge-more-password
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+90061@code.launchpad.net

Commit message

Drop a few more unused password-related bits and pieces from around the tree.

Description of the change

Drop a few more unused password-related bits and pieces from around the tree.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/app/validators/validation.py'
--- lib/lp/app/validators/validation.py 2012-01-17 03:49:38 +0000
+++ lib/lp/app/validators/validation.py 2012-01-25 09:58:30 +0000
@@ -12,7 +12,6 @@
12 'valid_cve_sequence',12 'valid_cve_sequence',
13 'validate_new_team_email',13 'validate_new_team_email',
14 'validate_new_person_email',14 'validate_new_person_email',
15 'valid_password',
16 'validate_date_interval',15 'validate_date_interval',
17 ]16 ]
1817
@@ -132,38 +131,6 @@
132 return True131 return True
133132
134133
135def valid_password(password):
136 """Return True if the argument is a valid password.
137
138 A valid password contains only ASCII characters in range(32,127).
139 No ASCII control characters are allowed.
140
141 password that contains only valid ASCII characters
142 >>> valid_password(u"All ascii password with spaces.:\\&/")
143 True
144
145 password that contains some non-ASCII character (value > 127)
146 >>> valid_password(u"password with some non-ascii" + unichr(195))
147 False
148
149 password that contains ASCII control characters (0 >= value >= 31)
150 >>> valid_password(u"password with control chars" + chr(20))
151 False
152
153 empty password.
154 >>> valid_password(u"")
155 True
156
157 """
158 assert isinstance(password, unicode)
159 valid_chars = [chr(x) for x in range(32, 127)]
160 invalid = set(password) - set(valid_chars)
161 if invalid:
162 return False
163 else:
164 return True
165
166
167def validate_date_interval(start_date, end_date, error_msg=None):134def validate_date_interval(start_date, end_date, error_msg=None):
168 """Check if start_date precedes end_date.135 """Check if start_date precedes end_date.
169136
170137
=== modified file 'lib/lp/services/fields/__init__.py'
--- lib/lp/services/fields/__init__.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/fields/__init__.py 2012-01-25 09:58:30 +0000
@@ -21,7 +21,6 @@
21 'IDescription',21 'IDescription',
22 'ILocationField',22 'ILocationField',
23 'INoneableTextLine',23 'INoneableTextLine',
24 'IPasswordField',
25 'IPersonChoice',24 'IPersonChoice',
26 'IStrippedTextLine',25 'IStrippedTextLine',
27 'ISummary',26 'ISummary',
@@ -37,7 +36,6 @@
37 'MugshotImageUpload',36 'MugshotImageUpload',
38 'NoneableDescription',37 'NoneableDescription',
39 'NoneableTextLine',38 'NoneableTextLine',
40 'PasswordField',
41 'PersonChoice',39 'PersonChoice',
42 'PillarAliases',40 'PillarAliases',
43 'PillarNameField',41 'PillarNameField',
@@ -81,7 +79,6 @@
81 Field,79 Field,
82 Float,80 Float,
83 Int,81 Int,
84 Password,
85 Text,82 Text,
86 TextLine,83 TextLine,
87 Tuple,84 Tuple,
@@ -94,7 +91,6 @@
94 IField,91 IField,
95 Interface,92 Interface,
96 IObject,93 IObject,
97 IPassword,
98 IText,94 IText,
99 ITextLine,95 ITextLine,
100 )96 )
@@ -152,11 +148,6 @@
152 """A field that allows entry of a Bug number or nickname"""148 """A field that allows entry of a Bug number or nickname"""
153149
154150
155class IPasswordField(IPassword):
156 """A field that ensures we only use http basic authentication safe
157 ascii characters."""
158
159
160class IAnnouncementDate(IDatetime):151class IAnnouncementDate(IDatetime):
161 """Marker interface for AnnouncementDate fields.152 """Marker interface for AnnouncementDate fields.
162153
@@ -418,17 +409,6 @@
418 return super(SearchTag, self).constraint(value)409 return super(SearchTag, self).constraint(value)
419410
420411
421class PasswordField(Password):
422 implements(IPasswordField)
423
424 def _validate(self, value):
425 # Local import to avoid circular imports
426 from lp.app.validators.validation import valid_password
427 if not valid_password(value):
428 raise LaunchpadValidationError(_(
429 "The password provided contains non-ASCII characters."))
430
431
432class UniqueField(TextLine):412class UniqueField(TextLine):
433 """Base class for fields that are used for unique attributes."""413 """Base class for fields that are used for unique attributes."""
434414
435415
=== modified file 'lib/lp/services/verification/interfaces/authtoken.py'
--- lib/lp/services/verification/interfaces/authtoken.py 2012-01-05 00:23:45 +0000
+++ lib/lp/services/verification/interfaces/authtoken.py 2012-01-25 09:58:30 +0000
@@ -29,7 +29,6 @@
29 )29 )
3030
31from lp import _31from lp import _
32from lp.services.fields import PasswordField
3332
3433
35class LoginTokenType(DBEnumeratedType):34class LoginTokenType(DBEnumeratedType):
@@ -174,10 +173,6 @@
174 # used for launchpad page layout173 # used for launchpad page layout
175 title = Attribute('Title')174 title = Attribute('Title')
176175
177 # Quick fix for Bug #2481
178 password = PasswordField(
179 title=_('Password'), required=True, readonly=False)
180
181 def consume():176 def consume():
182 """Mark this token as consumed by setting date_consumed.177 """Mark this token as consumed by setting date_consumed.
183178
@@ -188,13 +183,3 @@
188183
189 def sendEmailValidationRequest():184 def sendEmailValidationRequest():
190 """Send an email message with a magic URL to validate self.email."""185 """Send an email message with a magic URL to validate self.email."""
191
192 def sendPasswordResetEmail():
193 """Send an email message to the requester with a magic URL that allows
194 him to reset his password.
195 """
196
197 def sendNewUserEmail():
198 """Send an email message to the requester with a magic URL that allows
199 him to finish the Launchpad registration process.
200 """