def construct_forgotten_password_email(password_reset): link = get_url('/password-reset/%s/' % password_reset.token) unsubscribe_link = get_url('/ureporter/unsubscribe/') body = '<p>Hello from Ureport,</p>' \ '<p>You recently requested a reset of your ureport account password.</p>' \ '<p>To do this, please click this password recovery link to change your password: '******'</p>'\ '<p>-----</p>' \ '<p>Thanks,</p>' signature = '<p>Your friendly Ureport team</p>' footer = '<hr>' \ '<p>Please click <a href="' + unsubscribe_link + '">unsubscribe</a> ' \ 'to stop receiving email notifications</p>' return '%s%s%s' % (body, signature, footer)
def construct_forgotten_password_email(email): ureporter = Ureporter.objects.get(user__email=email) password_reset = PasswordReset.objects.get(user_id=ureporter.user.id) password_reset_link = get_url("/password-reset/%s/" % password_reset.token) unsubscribe_link = get_url("/profile/unsubscribe/%s" % ureporter.unsubscribe_token) body = ( "<p>Hello from U-Report,</p>" "<p>You recently requested a reset of your ureport account password.</p>" "<p>To do this, please click this password recovery link to change your password: %s</p>" "<p>-----</p>" "<p>Thanks,</p>" % password_reset_link ) signature = _("<p>Your friendly U-Report team</p>") footer = ( "<hr>" '<p>Please click <a href="%s">unsubscribe</a> ' "to stop receiving email notifications</p>" % unsubscribe_link ) return "%s%s%s" % (body, signature, footer)
def construct_new_poll_email(flow_info, latest_poll_id): unsubscribe_link = get_url('/ureporter/unsubscribe/') body = '<p>Hello Ureporter,</p>' \ '<p>We have published a new poll, "' + flow_info['title'] + '".</p>' \ '<p>Take the poll by clicking the following link: ' + \ settings.WEBPARTICIPATION_ROOT + '/poll/' + str(latest_poll_id) + '/respond/</p>' \ '<p>-----</p>' signature = '<p>Your friendly Ureport team</p>' footer = '<hr>' \ '<p>Please click <a href="' + unsubscribe_link + '">unsubscribe</a> ' \ 'to stop receiving email notifications</p>' return '%s%s%s' % (body, signature, footer)