Make E-Mails more verbose to avoid SPAM flag

This commit is contained in:
Dominik Heidler 2016-07-26 22:14:13 +02:00
parent 0505a5477b
commit 7845b007b5
1 changed files with 24 additions and 5 deletions

View File

@ -117,7 +117,11 @@ def user_info(nickname):
send_email(
recipient = request.form['email'],
subject = "Password for %s" % user['nickname'],
content = "Your Password: %s" % password
content = "Hello %s,\n\n" % user["nickname"] +
"You changed your email address on https://monitoring.freifunk-franken.de/\n" +
"To verify your new email address your password was changed to %s\n" % password +
"... and sent to your new address. Please log in and change it.\n\n" +
"Regards,\nFreifunk Franken Monitoring System"
)
return logout()
else:
@ -172,7 +176,11 @@ def register():
send_email(
recipient = request.form['email'],
subject = "Password for %s" % request.form['user'],
content = "Your Password: %s" % password
content = "Hello %s,\n\n" % request.form['user'] +
"You created an account on https://monitoring.freifunk-franken.de/\n" +
"To verify your new email address your password was autogenerated to %s\n" % password +
"... and sent to your address. Please log in and change it.\n\n" +
"Regards,\nFreifunk Franken Monitoring System"
)
flash("<b>Registration successful!</b> - Your password was sent to %s" % request.form['email'], "success")
except AccountWithEmailExists:
@ -186,20 +194,31 @@ def resetpw():
try:
if request.method == 'POST':
token = base64.b32encode(os.urandom(10)).decode()
user = db.users.find_one({"email": request.form['email']})
reset_user_password(request.form['email'], token)
send_email(
recipient = request.form['email'],
subject = "Password reset link",
content = url_for('resetpw', email=request.form['email'], token=token, _external=True)
content = "Hello %s,\n\n" % user["nickname"] +
"You attemped to reset your password on https://monitoring.freifunk-franken.de/\n" +
"To verify you a reset link was sent to you:\n" +
"%s\n" % url_for('resetpw', email=request.form['email'], token=token, _external=True) +
"Clicking this link will reset your password and send the new password to your email address.\n\n" +
"Regards,\nFreifunk Franken Monitoring System"
)
flash("<b>A password reset link was sent to %s</b>" % request.form['email'], "success")
elif "token" in request.args:
password = base64.b32encode(os.urandom(10)).decode()
reset_user_password(request.args['email'], request.args['token'], password)
user = db.users.find_one({"email": request.args['email']})
send_email(
recipient = request.args['email'],
subject = "Password",
content = "Your Password: %s" % password
subject = "Your new Password",
content = "Hello %s,\n\n" % user["nickname"] +
"You attemped to reset your password on https://monitoring.freifunk-franken.de/\n" +
"Your new Password: %s\n" % password +
"Please log in and change it\n\n" +
"Regards,\nFreifunk Franken Monitoring System"
)
flash("<b>Password reset successful!</b> - Your password was sent to %s" % request.args['email'], "success")
except AccountNotExisting: