fix: Add missing PasswordConfirmationRequired attributes

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2026-03-19 14:49:11 +01:00
parent 10d1cec02d
commit 364756e93d
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
5 changed files with 9 additions and 2 deletions

View file

@ -13,6 +13,7 @@ use OCA\OAuth2\Db\Client;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
use OCP\IL10N;
@ -40,6 +41,7 @@ class SettingsController extends Controller {
parent::__construct($appName, $request);
}
#[PasswordConfirmationRequired(strict: true)]
public function addClient(string $name,
string $redirectUri): JSONResponse {
if (filter_var($redirectUri, FILTER_VALIDATE_URL) === false) {
@ -66,6 +68,7 @@ class SettingsController extends Controller {
return new JSONResponse($result);
}
#[PasswordConfirmationRequired]
public function deleteClient(int $id): JSONResponse {
$client = $this->clientMapper->getByUid($id);

View file

@ -93,7 +93,7 @@ class AppsController extends OCSController {
*
* 200: App enabled successfully
*/
#[PasswordConfirmationRequired]
#[PasswordConfirmationRequired(strict: true)]
public function enable(string $app): DataResponse {
try {
$this->appManager->enableApp($app);

View file

@ -556,7 +556,7 @@ class AppSettingsController extends Controller {
* @param array $groups
* @return JSONResponse
*/
#[PasswordConfirmationRequired]
#[PasswordConfirmationRequired(strict: true)]
public function enableApps(array $appIds, array $groups = []): JSONResponse {
try {
$updateRequired = false;

View file

@ -10,6 +10,7 @@ use OC\Settings\AuthorizedGroup;
use OCA\Settings\Service\AuthorizedGroupService;
use OCA\Settings\Service\NotFoundException;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\DB\Exception;
use OCP\IRequest;
@ -27,6 +28,7 @@ class AuthorizedGroupController extends Controller {
* @throws NotFoundException
* @throws Exception
*/
#[PasswordConfirmationRequired(strict: true)]
public function saveSettings(array $newGroups, string $class): DataResponse {
$currentGroups = $this->authorizedGroupService->findExistingGroupsForClass($class);

View file

@ -11,6 +11,7 @@ namespace OCA\Settings\Controller;
use OC\Authentication\TwoFactorAuth\EnforcementState;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
@ -31,6 +32,7 @@ class TwoFactorSettingsController extends Controller {
return new JSONResponse($this->mandatoryTwoFactor->getState());
}
#[PasswordConfirmationRequired(strict: true)]
public function update(bool $enforced, array $enforcedGroups = [], array $excludedGroups = []): JSONResponse {
$this->mandatoryTwoFactor->setState(
new EnforcementState($enforced, $enforcedGroups, $excludedGroups)