/**
* This override just add en extra variable (username) to be able to salt the password
- * the way Wallabag v1 does. It will avoid to break compatibility with Wallabag v1
- *
+ * the way Wallabag v1 does. It will avoid to break compatibility with Wallabag v1.
*/
class WallabagPasswordEncoder extends BasePasswordEncoder
{
*/
public function encodePassword($raw, $salt)
{
- if (null === $this->username) {
- throw new \LogicException('We can not check the password without a username.');
- }
-
if ($this->isPasswordTooLong($raw)) {
throw new BadCredentialsException('Invalid password.');
}
$digest = hash($this->algorithm, $salted, true);
// "stretch" hash
- for ($i = 1; $i < $this->iterations; $i++) {
+ for ($i = 1; $i < $this->iterations; ++$i) {
$digest = hash($this->algorithm, $digest.$salted, true);
}
*/
protected function mergePasswordAndSalt($password, $salt)
{
+ if (null === $this->username) {
+ throw new \LogicException('We can not check the password without a username.');
+ }
+
if (empty($salt)) {
return $password;
}