Add reset pending email endpoint to user controller

This commit is contained in:
Constantin Graf
2026-05-28 20:45:27 +02:00
parent 10a66fa065
commit 1f4a957258
3 changed files with 83 additions and 0 deletions

View File

@@ -100,6 +100,27 @@ class UserController extends Controller
return new UserResource($user);
}
/**
* Reset the pending email for a user.
*
* This endpoint is independent of the organization.
*
* @operationId resetUserPendingEmail
*
* @throws AuthorizationException Thrown when the authenticated user does not match the user whose email is pending verification.
*/
public function resetPendingEmail(User $user): JsonResponse
{
if ($user->getKey() !== $this->user()->getKey()) {
throw new AuthorizationException;
}
$user->pending_email = null;
$user->save();
return response()->json(null, 204);
}
/**
* Resend the pending email update verification email.
*