aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman_pgp/commands/eml_key.py5
-rw-r--r--src/mailman_pgp/workflows/base.py18
2 files changed, 18 insertions, 5 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py
index 15db0b1..fbae25e 100644
--- a/src/mailman_pgp/commands/eml_key.py
+++ b/src/mailman_pgp/commands/eml_key.py
@@ -65,8 +65,11 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results):
print('No adddress to subscribe with.', file=results)
return ContinueProcessing.no
+
with transaction() as t:
- pgp_address = PGPAddress(address)
+ pgp_address = PGPAddress.for_address(address)
+ if pgp_address is None:
+ pgp_address = PGPAddress(address)
pgp_address.key = keys.pop()
t.add(pgp_address)
diff --git a/src/mailman_pgp/workflows/base.py b/src/mailman_pgp/workflows/base.py
index 4ca1525..ace8f91 100644
--- a/src/mailman_pgp/workflows/base.py
+++ b/src/mailman_pgp/workflows/base.py
@@ -65,11 +65,21 @@ class PubkeyMixin:
def _step_pubkey_checks(self):
self.push('restore_subscriber')
- if not self.pubkey:
- self.push('send_key_request')
+
+ pgp_address = PGPAddress.for_address(self.address)
+
+ if pgp_address is not None:
+ if not pgp_address.key:
+ self.push('send_key_request')
+ else:
+ if not pgp_address.key_confirmed:
+ self.push('send_key_confirm_request')
else:
- if not self.pubkey_confirmed:
- self.push('send_key_confirm_request')
+ if not self.pubkey:
+ self.push('send_key_request')
+ else:
+ if not self.pubkey_confirmed:
+ self.push('send_key_confirm_request')
def _step_send_key_request(self):
self._set_token(TokenOwner.subscriber)