Salted Passwords in Extbase FeUser Domain Model

For a current project I needed to create an "Change Password" functionality with Extbase. Since the passwords on this projects had to be encrypted with saltedpasswords extension, I needed them to be encrypted in my Extbase domain model. Here are the relevant lines of code to achieve this:

	/**
	 * Setter for password. As we have encrypted passwords here, we need to encrypt them before storing!
	 *
	 * @param $password
	 */
	public function setPassword($password) {
		if (t3lib_extMgm::isLoaded('saltedpasswords')) {
			$saltedpasswordsInstance = tx_saltedpasswords_salts_factory::getSaltingInstance();
			$encryptedPassword = $saltedpasswordsInstance->getHashedPassword($password);
			$this->password = $encryptedPassword;
		} else {
			parent::setPassword($password);
		}
	}
Add this lines to your class extending Tx_Extbase_Domain_Model_FrontendUser

Further informations for salted passwords in TYPO3 can be found here:
http://www.slideshare.net/StephenKing/secure-password-storing-with-saltedpasswords-in-typo3


 
Inhalt © Michael Knoll 2009-2017  •  Powered by TYPO3  •  TypoScript Blogging by Fabrizio Branca  •  TYPO3 Photo Gallery Management by yag  •  Impressum