Code Duplication    Length = 4-7 lines in 2 locations

apps/dav/lib/Connector/PublicAuth.php 1 location

@@ 100-103 (lines=4) @@
97
			if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
98
				if ($this->shareManager->checkPassword($share, $password)) {
99
					return true;
100
				} elseif ($this->session->exists('public_link_authenticated')
101
					&& $this->session->get('public_link_authenticated') === (string)$share->getId()) {
102
					return true;
103
				} else {
104
					if (\in_array('XMLHttpRequest', \explode(',', $this->request->getHeader('X-Requested-With')))) {
105
						// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
106
						\http_response_code(401);

apps/files_sharing/lib/Controllers/ShareController.php 1 location

@@ 190-196 (lines=7) @@
187
				$this->emitAccessShareHook($share, 403, 'Wrong password');
188
				return false;
189
			}
190
		} else {
191
			// not authenticated ?
192
			if (! $this->session->exists('public_link_authenticated')
193
				|| $this->session->get('public_link_authenticated') !== (string)$share->getId()) {
194
				return false;
195
			}
196
		}
197
		return true;
198
	}
199