Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Added MemberCsvBulkLoaderTest->testCleartextPasswordsAreHashedW…

…ithDefaultAlgo()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@98841 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit d552becce8f584d680c39f2a0ec8d489581532e4 1 parent 021c5af
@chillu chillu authored
View
16 tests/security/MemberCsvBulkLoaderTest.php
@@ -58,4 +58,20 @@ function testAddToCsvColumnGroupsByCode() {
$this->assertEquals($created[0]->Groups()->column('ID'), array($existinggroup->ID));
$this->assertEquals($created[1]->Groups()->column('ID'), array($existinggroup->ID, $newgroup->ID));
}
+
+ function testCleartextPasswordsAreHashedWithDefaultAlgo() {
+ $loader = new MemberCsvBulkLoader();
+
+ $results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest_cleartextpws.csv');
+
+ $member = $results->Created()->First();
+ $memberID = $member->ID;
+ DataObject::flush_and_destroy_cache();
+ $member = DataObject::get_by_id('Member', $memberID);
+
+ // TODO Direct getter doesn't work, wtf!
+ $this->assertEquals(Security::get_password_encryption_algorithm(), $member->getField('PasswordEncryption'));
+ $result = $member->checkPassword('mypassword');
+ $this->assertTrue($result->valid());
+ }
}
View
2  tests/security/MemberCsvBulkLoaderTest_cleartextpws.csv
@@ -0,0 +1,2 @@
+FirstName,Surname,Email,Password
+author1_first,author1_last,author1@test.com,mypassword
Please sign in to comment.
Something went wrong with that request. Please try again.