OCA\Richdocuments\File::checkPassword PHP Method

checkPassword() public method

public checkPassword ( string $password ) : boolean
$password string
return boolean
    public function checkPassword($password)
    {
        $shareId = $this->sharing['id'];
        if (!$this->isPasswordProtected() || \OC::$server->getSession()->exists('public_link_authenticated') && \OC::$server->getSession()->get('public_link_authenticated') === $shareId) {
            return true;
        }
        // Check Password
        $newHash = '';
        if (\OC::$server->getHasher()->verify($password, $this->getPassword(), $newHash)) {
            \OC::$server->getSession()->set('public_link_authenticated', $shareId);
            /**
             * FIXME: Migrate old hashes to new hash format
             * Due to the fact that there is no reasonable functionality to update the password
             * of an existing share no migration is yet performed there.
             * The only possibility is to update the existing share which will result in a new
             * share ID and is a major hack.
             *
             * In the future the migration should be performed once there is a proper method
             * to update the share's password. (for example `$share->updatePassword($password)`
             *
             * @link https://github.com/owncloud/core/issues/10671
             */
            if (!empty($newHash)) {
            }
            return true;
        }
        return false;
    }