Example #1
0
 /**
  * Verify the password of a public share
  *
  * @param \OCP\Share\IShare $share
  * @param string $password
  * @return bool
  */
 public function checkPassword(\OCP\Share\IShare $share, $password)
 {
     if ($share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK) {
         //TODO maybe exception?
         return false;
     }
     if ($password === null || $share->getPassword() === null) {
         return false;
     }
     $newHash = '';
     if (!$this->hasher->verify($password, $share->getPassword(), $newHash)) {
         return false;
     }
     if (!empty($newHash)) {
         $share->setPassword($newHash);
         $provider = $this->factory->getProviderForType($share->getShareType());
         $provider->update($share);
     }
     return true;
 }