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

pull/33/head
fkrone 8 years ago
parent bbab1b1070
commit aa24cc2b4b

@ -124,8 +124,23 @@ if __name__ == "__main__":
sig = sign_part
payload = {'email': from_addr, 'key': sig}
r = requests.post(cfg['mailregister']['webpanel_url'], data=payload)
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'))
log("PGP registration is handed over to GPGMW")
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)

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