Browse Source

Inform the user if registration failed because GPG-Mailgate-Web could not be reached.

pull/33/head
fkrone 7 years ago
parent
commit
aa24cc2b4b
  1. 17
      register-handler.py
  2. 1
      register_templates/gpgmwFailed.md

17
register-handler.py

@ -125,7 +125,22 @@ if __name__ == "__main__":
payload = {'email': from_addr, 'key': sig}
r = requests.post(cfg['mailregister']['webpanel_url'], data=payload)
log("PGP registration is handed over to GPGMW")
if r.status_code != 200:
log("Could not hand registration over to GPGMW. Error: %s" % r.status_code)
error_msg = file(cfg['mailregister']['mail_templates']+"/gpgmwFailed.md").read()
error_msg = error_msg.replace("[:FROMADDRESS:]",from_addr)
msg = MIMEMultipart("alternative")
msg["From"] = cfg['mailregister']['register_email']
msg["To"] = from_addr
msg["Subject"] = "PGP key registration failed"
msg.attach(MIMEText(error_msg, 'plain'))
msg.attach(MIMEText(markdown.markdown(error_msg), 'html'))
send_msg(msg, cfg['mailregister']['register_email'], [from_addr])
else:
log("PGP registration is handed over to GPGMW")
# except:
# log("Registration exception")
# sys.exit(0)

1
register_templates/gpgmwFailed.md

@ -0,0 +1 @@
Could not register your PGP key due to a server error. Please contact the administrator.
Loading…
Cancel
Save