Created
November 14, 2014 23:36
-
-
Save briceburg/0e8e537b368b8aadeb83 to your computer and use it in GitHub Desktop.
SodiumFreePasswordEncryptor ( Salt-less MD5, SHA, &c ) - The necessary evil for seamlessly migrating accounts/passwords into SilverStripe 3.1 + projects
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
| <?php | |
| /** | |
| * Sodium Free Password Encryptor -- for importing legacy passwords | |
| * into SilverSripe 3.1+ projects | |
| * | |
| * 1. Register via mysite/_config/encryptors.yml, e.g. | |
| ** | |
| --- | |
| PasswordEncryptor: | |
| encryptors: | |
| sf_md5: | |
| SodiumFreePasswordEncryptor: md5 | |
| sf_sha1: | |
| SodiumFreePasswordEncryptor: sha1 | |
| * example usage | |
| ** | |
| $member = new Member(); | |
| $member->Email = 'brice@brice.com'; | |
| $member->Password = 'brice'; | |
| $member->PasswordEncryption = 'sf_md5'; | |
| $member->write(); | |
| ** | |
| */ | |
| class SodiumFreePasswordEncryptor extends PasswordEncryptor_PHPHash { | |
| public function salt($password, $member = null){ | |
| return ''; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment