'storePasswordForRehash', SecurityEvents::INTERACTIVE_LOGIN => [ ['handleRehash', 300], ], ]; } public function storePasswordForRehash(GenericEvent $rawPassword) { $this->rawPasswordForRehash = $rawPassword->getSubject(); } public function handleRehash(InteractiveLoginEvent $event) { // this method will be triggered after each login, continue only if there is a legacy password if (!$this->rawPasswordForRehash) { return; } // get the logged in user /** @var $user User */ $user = $event->getAuthenticationToken()->getUser(); // load a correct password encoder $encoder = $this->hasherFactory->getPasswordHasher($user); // rehash $newPassword = $encoder->hash($this->rawPasswordForRehash); $this->updateSQL('users', ['passw' => $newPassword], ['id' => $user->getID()]); } }