aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/commands/eml_key.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
-rw-r--r--src/mailman_pgp/commands/eml_key.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py
index 0437430..e792fa4 100644
--- a/src/mailman_pgp/commands/eml_key.py
+++ b/src/mailman_pgp/commands/eml_key.py
@@ -183,6 +183,16 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results):
file=results)
return ContinueProcessing.no
+ email = get_email(msg)
+ if not email:
+ print('No email to change key of.', file=results)
+ return ContinueProcessing.no
+
+ pgp_address = PGPAddress.for_email(email)
+ if pgp_address is None:
+ print('A pgp enabled address not found.', file=results)
+ return ContinueProcessing.no
+
wrapped = PGPWrapper(msg)
if wrapped.is_encrypted():
decrypted = wrapped.decrypt(pgp_list.key)
@@ -197,16 +207,6 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results):
print('More than one key! Send only one key.', file=results)
return ContinueProcessing.no
- email = get_email(msg)
- if not email:
- print('No email to change key of.', file=results)
- return ContinueProcessing.no
-
- pgp_address = PGPAddress.for_email(email)
- if pgp_address is None:
- print('A pgp enabled address not found.', file=results)
- return ContinueProcessing.no
-
workflow = KeyChangeWorkflow(mlist, pgp_address, keys.pop())
list(workflow)
print('Key change request received.', file=results)