Skip to content

Classic-UI view: _add_identity path is unreachable (_provider_names returns configured providers, not the user's identities) #116

Description

@ericof

In AuthomaticView.__call__ (browser/view.py), an authenticated user visiting a configured provider always hits:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions