collective / collective/pas.plugins.authomatic
Classic-UI view: `_add_identity` path is unreachable (`_provider_names` returns configured providers, not the user's identities)
- Dominant language
- Python
- Stars
- 10
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
In `AuthomaticView.__call__` (`browser/view.py`), an authenticated user visiting a configured provider always hits:
```python
if not self.is_anon:
if provider in self._provider_names:
return self._redirect()
```
`_provider_names` returns the **configured** providers (`self.config.keys()`), and `provider` has already been validated against `cfg` earlier in `__call__`, so `provider in self._provider_names` is **always true** here. As a result the code never reaches the `_add_identity` branch further down — the "add a provider identity to an existing, logged-in account" feature is effectively dead via this view, and `view.py` lines ~135/151 are unreachable (surfaced while raising coverage to 97% in #112).
The check most likely intended to compare against the **current user's already-connected identities**, not the configured providers.
### Suggested fix
- Add a method returning the logged-in user's connected provider names (from the plugin's `UserIdentities`), and gate the early redirect on that instead of `_provider_names`.
- Add a test covering the authenticated "add identity" flow once reachable.
Found during PR #115.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.