-
Notifications
You must be signed in to change notification settings - Fork 554
sent password reset email even for getpersonas migrated accounts (bug 998477) #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
magopian
merged 1 commit into
mozilla:master
from
magopian:998477-password-reset-email-not-sent
May 7, 2014
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,11 +221,13 @@ class TestPasswords(amo.tests.TestCase): | |
| def test_invalid_old_password(self): | ||
| u = UserProfile(password=self.utf) | ||
| assert u.check_password(self.utf) is False | ||
| assert u.has_usable_password() is True | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need "is True" given that |
||
|
|
||
| def test_invalid_new_password(self): | ||
| u = UserProfile() | ||
| u.set_password(self.utf) | ||
| assert u.check_password('wrong') is False | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_valid_old_password(self): | ||
| hsh = hashlib.md5(encoding.smart_str(self.utf)).hexdigest() | ||
|
|
@@ -235,55 +237,64 @@ def test_valid_old_password(self): | |
| algo, salt, hsh = u.password.split('$') | ||
| eq_(algo, 'sha512') | ||
| eq_(hsh, get_hexdigest(algo, salt, self.utf)) | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_valid_new_password(self): | ||
| u = UserProfile() | ||
| u.set_password(self.utf) | ||
| assert u.check_password(self.utf) is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_md5(self): | ||
| md5 = hashlib.md5('password').hexdigest() | ||
| hsh = hashlib.sha512(self.bytes_ + md5).hexdigest() | ||
| u = UserProfile(password='sha512+MD5$%s$%s' % | ||
| (self.bytes_, hsh)) | ||
| assert u.check_password('password') is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_base64(self): | ||
| hsh = hashlib.sha512(self.bytes_ + 'password').hexdigest() | ||
| u = UserProfile(password='sha512+base64$%s$%s' % | ||
| (encodestring(self.bytes_), hsh)) | ||
| assert u.check_password('password') is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_base64_maybe_utf8(self): | ||
| hsh = hashlib.sha512(self.bytes_ + self.utf.encode('utf8')).hexdigest() | ||
| u = UserProfile(password='sha512+base64$%s$%s' % | ||
| (encodestring(self.bytes_), hsh)) | ||
| assert u.check_password(self.utf) is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_base64_maybe_latin1(self): | ||
| passwd = u'fo\xf3' | ||
| hsh = hashlib.sha512(self.bytes_ + passwd.encode('latin1')).hexdigest() | ||
| u = UserProfile(password='sha512+base64$%s$%s' % | ||
| (encodestring(self.bytes_), hsh)) | ||
| assert u.check_password(passwd) is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_base64_maybe_not_latin1(self): | ||
| passwd = u'fo\xf3' | ||
| hsh = hashlib.sha512(self.bytes_ + passwd.encode('latin1')).hexdigest() | ||
| u = UserProfile(password='sha512+base64$%s$%s' % | ||
| (encodestring(self.bytes_), hsh)) | ||
| assert u.check_password(self.utf) is False | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_persona_sha512_md5_base64(self): | ||
| md5 = hashlib.md5('password').hexdigest() | ||
| hsh = hashlib.sha512(self.bytes_ + md5).hexdigest() | ||
| u = UserProfile(password='sha512+MD5+base64$%s$%s' % | ||
| (encodestring(self.bytes_), hsh)) | ||
| assert u.check_password('password') is True | ||
| assert u.has_usable_password() is True | ||
|
|
||
| def test_browserid_password(self): | ||
| u = UserProfile(password=self.utf, source=amo.LOGIN_SOURCE_UNKNOWN) | ||
| assert not u.check_password('foo') | ||
| assert u.has_usable_password() is True | ||
|
|
||
| @patch('access.acl.action_allowed_user') | ||
| def test_needs_tougher_password(self, action_allowed_user): | ||
|
|
@@ -312,6 +323,12 @@ def test_sha512(self): | |
| self.assertTrue(check_password('', blank_encoded)) | ||
| self.assertFalse(check_password(' ', blank_encoded)) | ||
|
|
||
| def test_empty_password(self): | ||
| profile = UserProfile(password=None) | ||
| assert profile.has_usable_password() is False | ||
| profile = UserProfile(password='') | ||
| assert profile.has_usable_password() is False | ||
|
|
||
|
|
||
| class TestBlacklistedUsername(amo.tests.TestCase): | ||
| fixtures = ['users/test_backends'] | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will (softly) clash with PR for https://bugzilla.mozilla.org/show_bug.cgi?id=700599
We just need to keep this in mind when we merge this or the other PR.