예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function updatePassword(UserInterface $user)
 {
     if (0 !== strlen($password = $user->getPlainPassword())) {
         $passwordDigesta = md5($user->getUsernameCanonical() . ':SabreDAV:' . $password);
         $salt = $user->getSalt();
         $salted = $password . '{' . $salt . '}';
         $digest = hash('sha512', $salted, true);
         for ($i = 1; $i < 5000; $i++) {
             $digest = hash('sha512', $digest . $salted, true);
         }
         $encodedPassword = base64_encode($digest);
         $user->setPassword($encodedPassword);
         $user->setPasswordDigesta($passwordDigesta);
         $user->eraseCredentials();
     }
 }