-
Notifications
You must be signed in to change notification settings - Fork 0
ionosmail get app password + External Mail Account Provider System Implementation #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ovider system Add provider system with IMailAccountProvider interface, ProviderRegistryService, and ExternalAccountsController. Includes ProviderCapabilities for declaring provider features, AccountProviderService for business logic, and comprehensive unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Relocate MailAccountConfig and MailServerConfig from lib/Service/IONOS/Dto to lib/Provider/MailAccountProvider/Common/Dto to make them reusable by multiple providers. Update imports in consuming classes and move unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…d cleanup integration Add AccountProviderService to PageController to expose mail-providers-available config to frontend. Integrate ProviderRegistryService into UserDeletedListener for provider-managed account cleanup. Update unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…r for mail config availability check Refactor IonosMailConfigService.isMailConfigAvailable to accept optional user ID parameter. Add unit tests to verify behavior with explicit user IDs. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
e75efc8 to
39cc274
Compare
39cc274 to
32f8d27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a comprehensive, provider-agnostic mail account management system that replaces the legacy IONOS-specific implementation with a flexible, pluggable architecture. The new system introduces clean abstraction layers allowing external mail services (like IONOS Nextcloud Workspace Mail) to integrate seamlessly through well-defined interfaces.
Key Changes
- Provider Architecture: New interfaces (
IMailAccountProvider,IProviderCapabilities) with registry service for managing providers - IONOS Provider Refactoring: Full reimplementation using the provider system with code relocated to dedicated namespace
- Frontend Integration: Generic
ExternalProviderTabcomponent with app password management UI and retry logic - OCC Commands: Four new commands for provider management (
list,status,create-account,generate-password)
Reviewed changes
Copilot reviewed 68 out of 68 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Service/AccountServiceTest.php | Updated to use ProviderRegistryService instead of IonosAccountDeletionService |
| tests/Unit/Service/AccountProviderServiceTest.php | New test suite for provider metadata service |
| tests/Unit/Provider/MailAccountProvider/ProviderRegistryServiceTest.php | Comprehensive tests for provider registry |
| tests/Unit/Provider/MailAccountProvider/Implementations/IonosProviderTest.php | Tests for IONOS provider implementation |
| tests/Unit/Provider/MailAccountProvider/Implementations/Ionos/IonosProviderFacadeTest.php | Tests for IONOS facade pattern |
| tests/Unit/Controller/ExternalAccountsControllerTest.php | Tests for generic provider controller (602 lines) |
| tests/Unit/Command/Provider*.php | Test suites for all 4 OCC commands |
| lib/Provider/MailAccountProvider/*.php | Core provider system interfaces and implementations |
| lib/Service/AccountProviderService.php | Business logic for provider metadata |
| src/components/ExternalProviderTab.vue | Generic provider UI with retry logic |
| src/components/ProviderAppPassword.vue | App password management component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Unit/Provider/MailAccountProvider/Implementations/IonosProviderTest.php
Outdated
Show resolved
Hide resolved
lib/Provider/MailAccountProvider/Implementations/Ionos/Service/IonosConfigService.php
Outdated
Show resolved
Hide resolved
...vider/MailAccountProvider/Implementations/Ionos/Service/Core/IonosAccountMutationService.php
Show resolved
Hide resolved
bromiesTM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provisional ok but lets discuss whether we need translations for a release
…e Mail account provider Add IonosProvider implementation with IonosProviderFacade, IonosAccountMutationService, and IonosAccountQueryService. Includes comprehensive unit tests for all components. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…ication bootstrap Register IonosProvider in Application.boot() with exception handling and logging. Add unit tests for constructor, provider registration flow, and error handling. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…mponent Add ExternalProviderTab component to replace IONOS-specific NewEmailAddressTab with provider-agnostic implementation. Update AccountForm.vue to use new component. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Remove IonosAccountsController, IonosServiceException, and related routes. These are superseded by the provider system. Update tests and remove obsolete code. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…r namespace Relocate all IONOS services from lib/Service/IONOS to lib/Provider/MailAccountProvider/Implementations/Ionos/Service. Update namespace declarations and imports in consuming classes. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…n during account creation Implement progressive user feedback and retry mechanism in ExternalProviderTab. Retry mailbox fetch 3 times with exponential backoff and jitter (2-3s, 4-6s). Show clear status messages during each phase. Redirect after max retries with message about delayed sync. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…provider management Add ProviderCommandBase, ProviderList, ProviderStatus, ProviderCreateAccount, and ProviderDeleteAccount commands with full parameter validation, error handling, and comprehensive unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…o.xml Register ProviderList, ProviderStatus, ProviderCreateAccount, ProviderGenerateAppPassword, and ProviderDeleteAccount in info.xml. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…ords for external accounts
Add ExternalAccountsController.generatePassword() endpoint with route
/api/providers/{providerId}/password. Add IProviderCapabilities.supportsAppPasswordGeneration
and IMailAccountProvider.generateAppPassword(). Update README with documentation.
Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…e Mail app password reset Implement IonosProvider.generateAppPassword() using IonosProviderFacade.generateAppPassword() which calls IonosAccountMutationService.resetPassword(). Add comprehensive unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…rovider app password generation Add ProviderGenerateAppPassword command with full parameter validation and comprehensive unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…ord command in info.xml Register ProviderGenerateAppPassword in info.xml. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…s documentation Add doc/provider-commands.md with usage, parameters, examples, workflows, troubleshooting, and testing instructions for all provider management commands. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…property to readonly in PageController Make PageController.accountProviderService readonly and add provider metadata to serialized account data. Update unit tests. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…ponse with provider metadata Updated the ExternalAccountsController to include provider metadata in the account creation response. This change improves the information returned to the client, facilitating better integration with the account provider service. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…ider-managed accounts Add ProviderPasswordService.js for API calls, ProviderAppPassword.vue component for password reset UI with generate/copy functionality. Integrate into AccountSettings.vue for provider-managed accounts with app password support. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Signed-off-by: Kai Henseler <[email protected]>
Signed-off-by: Kai Henseler <[email protected]>
dd0352f to
6c32a2b
Compare
…Service Replace manual directory traversal with dirname() function for better readability and maintainability when constructing public_suffix_list.dat path. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
6c32a2b to
9682525
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 84 out of 84 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR implements a comprehensive, provider-agnostic mail account management system that replaces the legacy IONOS-specific implementation with a flexible, pluggable architecture.
Overview
The new provider system introduces a clean abstraction layer that allows external mail services (like IONOS Nextcloud Workspace Mail) to integrate seamlessly with the Nextcloud Mail app through a well-defined interface. The IONOS implementation has been refactored to use this new system while keeping all IONOS-specific code isolated in a dedicated namespace.
Key Features
🏗️ Provider Architecture
IMailAccountProviderandIProviderCapabilitiesdefine the contract for external mail account providersProviderRegistryServicemanages provider registration and lifecycleAccountProviderServicehandles provider-specific operationsExternalAccountsControllerexposes REST API endpoints for provider operations🔌 IONOS Provider Implementation
lib/Provider/MailAccountProvider/Implementations/Ionos/IonosProviderFacade) for clean architecture🖥️ Frontend Integration
ExternalProviderTabcomponent replaces IONOS-specific UIProviderAppPassword.vue) for password reset with generate/copy functionality⚙️ OCC Commands
mail:provider:list- List all registered providersmail:provider:status- Check provider availability for usermail:provider:create-account- Create mail account via providermail:provider:generate-password- Generate new app passwordFull documentation available in doc/provider-commands.md
🔐 App Password Management
POST /api/providers/{providerId}/passwordsupportsAppPasswordGenerationcapability declarationgenerateAppPassword()interface methodAccountSettings.vueTechnical Changes
Architecture Improvements
Commonnamespace for reusabilityProviderServiceExceptionfor provider-specific errorsUserDeletedListenerAPI Changes
/api/ionos/*routes (superseded by provider system)Code Quality
declare(strict_types=1)Removed/Deprecated
IonosAccountsController(replaced byExternalAccountsController)IonosServiceException(replaced byProviderServiceException)routes.phpNewEmailAddressTab.vue(replaced byExternalProviderTab.vue)Migration Notes
The new system is backward compatible - existing IONOS accounts continue to work. The IONOS implementation has been internally refactored but maintains the same external behavior with enhanced capabilities:
Files Changed
Testing
All changes are covered by comprehensive unit tests:
ProviderRegistryServiceTest,AccountProviderServiceTestIonosProviderTest,IonosProviderFacadeTestExternalAccountsControllerTest(602 lines)This refactoring provides a solid foundation for adding additional mail providers in the future while maintaining clean separation of concerns and minimal impact on the core Mail app functionality.