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

This commit is contained in:
fkrone 2015-06-04 21:52:39 +02:00
parent bbab1b1070
commit aa24cc2b4b
2 changed files with 17 additions and 1 deletions

View File

@ -125,6 +125,21 @@ if __name__ == "__main__":
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'))
send_msg(msg, cfg['mailregister']['register_email'], [from_addr])
else:
log("PGP registration is handed over to GPGMW")
# except:
# log("Registration exception")

View File

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