Skip to content

Commit

Permalink
Remove the salt from the user entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Coderberg committed Apr 24, 2024
1 parent e2a4aff commit 9d44088
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@ public function setRoles(array $roles): void
$this->roles = $roles;
}

/**
* Returns the salt that was originally used to encode the password.
*/
public function getSalt(): ?string
{
// See "Do you need to use a Salt?" at https://symfony.com/doc/current/cookbook/security/entity_provider.html
// we're using bcrypt in security.yml to encode the password, so
// the salt value is built-in and you don't have to generate one
return null;
}

/**
* Removes sensitive data from the user.
*/
Expand All @@ -145,13 +134,11 @@ public function eraseCredentials(): void

public function __serialize(): array
{
// add $this->salt too if you don't use Bcrypt or Argon2i
return [$this->id, $this->username, $this->password];
}

public function __unserialize(array $data): void
{
// add $this->salt too if you don't use Bcrypt or Argon2i
[$this->id, $this->username, $this->password] = $data;
}

Expand Down

0 comments on commit 9d44088

Please sign in to comment.