Code Duplication    Length = 14-14 lines in 2 locations

apps/files_external/lib/auth/password/logincredentials.php 1 location

@@ 77-90 (lines=14) @@
74
		$this->credentialsManager->store($userId, self::CREDENTIALS_IDENTIFIER, $credentials);
75
	}
76
77
	public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
78
		if (!isset($user)) {
79
			throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
80
		}
81
		$uid = $user->getUID();
82
		$credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
83
84
		if (!isset($credentials)) {
85
			throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
86
		}
87
88
		$storage->setBackendOption('user', $credentials['user']);
89
		$storage->setBackendOption('password', $credentials['password']);
90
	}
91
92
}
93

apps/files_external/lib/auth/password/userprovided.php 1 location

@@ 73-86 (lines=14) @@
70
		]);
71
	}
72
73
	public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
74
		if (!isset($user)) {
75
			throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
76
		}
77
		$uid = $user->getUID();
78
		$credentials = $this->credentialsManager->retrieve($uid, $this->getCredentialsIdentifier($storage->getId()));
79
80
		if (!isset($credentials)) {
81
			throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
82
		}
83
84
		$storage->setBackendOption('user', $credentials['user']);
85
		$storage->setBackendOption('password', $credentials['password']);
86
	}
87
88
}
89