~maxiberta/canonical-identity-provider/vanilla-sshkeys-debug

Viewing all changes in revision 1708.

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Jonathan Hartley
  • Date: 2020-01-10 16:30:33 UTC
  • mfrom: (1703.1.18 canonical-identity-provider)
  • Revision ID: otto-copilot@canonical.com-20200110163033-px4ucyt3160acrar
Remove code that cannot be reached.

The containing 'if not account.can_reset_password',
16 lines up from the deletion,
does not check whether there are any validated email addresses.
Instead it just checks that account.status must be either
Suspended or Deleted.

Suspended accounts are handled by an early return,
9 lines up from the deletion.

Deleted accounts also delete their associated email addresses,
so can not be retrieved by the Account.get_by_email call
near the start of this method.

There was a test for this deleted code,
but it monkey patched a fake value to make this code reachable.
I tried replacing the test with one that didn't do monkey patching
(e.g. using a deleted account would be the only way)
but was unable to make the code reachable.

In practice, accounts with no validated email addresses pass
right by this code, and end up reading from account.preferredemail,
14 lines below the deletion,
which falls back to using a new email address.

Merged from https://code.launchpad.net/~tartley/canonical-identity-provider/rm-no-verified-address-para/+merge/377382

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: