/** * Helper function for sLogin * Called when provided user data is correct * Logs in the user * * @param $getUser * @param $email * @param $password * @param $isPreHashed * @param $encoderName * @param $plaintext * @param $hash */ private function loginUser($getUser, $email, $password, $isPreHashed, $encoderName, $plaintext, $hash) { $this->regenerateSessionId(); $this->db->update('s_user', array('lastlogin' => new Zend_Date(), 'failedlogins' => 0, 'lockeduntil' => null, 'sessionID' => $this->session->offsetGet('sessionId')), array('id = ?' => $getUser["id"])); $this->eventManager->notify('Shopware_Modules_Admin_Login_Successful', array('subject' => $this, 'email' => $email, 'password' => $password, 'user' => $getUser)); $newHash = ''; $liveMigration = $this->config->offsetGet('liveMigration'); $defaultEncoderName = $this->passwordEncoder->getDefaultPasswordEncoderName(); // Do not allow live migration when the password is prehashed if ($liveMigration && !$isPreHashed && $encoderName !== $defaultEncoderName) { $newHash = $this->passwordEncoder->encodePassword($plaintext, $defaultEncoderName); $encoderName = $defaultEncoderName; } if (empty($newHash)) { $newHash = $this->passwordEncoder->reencodePassword($plaintext, $hash, $encoderName); } if (!empty($newHash) && $newHash !== $hash) { $hash = $newHash; $userId = (int) $getUser['id']; $this->db->update('s_user', array('password' => $hash, 'encoder' => $encoderName), 'id = ' . $userId); } $this->session->offsetSet('sUserMail', $email); $this->session->offsetSet('sUserPassword', $hash); $this->session->offsetSet('sUserId', $getUser["id"]); $this->sCheckUser(); }
/** * @return string */ private function getEncoder() { return $this->passwordManager->getDefaultPasswordEncoderName(); }