Skip to content

Commit

Permalink
Merge pull request #6471 from OCHA-DAP/feature/HDX-10285-dataset-titl…
Browse files Browse the repository at this point in the history
…e-in-validation-email

PR HDX-10285 dataset title in validatino email
  • Loading branch information
danmihaila authored Oct 31, 2024
2 parents 9bd775d + aa785ab commit efec723
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<p>Dear HDX User,</p>

<p>You're subscribing to the <a href="{{ h.url_for('hdx_dataset.read', id=data.dataset_id, _external=True) }}" target="_blank"> {{ data.dataset_title }}</a> dataset</p>
<p>Please verify your email by clicking the button below:</p>

<a href="{{ data.verify_email_link }}" target="_blank" title="Verify email" class="button">Verify email</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def subscribe_to_dataset() -> Response:
try:
token_obj = notification_platform_logic.verify_email_validation_token(token)
except Exception as e:
_h.flash_error('Your token is invalid or has expired. Please try to subscribe again.')
_h.flash_error('Your token is invalid. Your email address might have already been validated.')
EmailValidationAnalyticsSender('notification platform', False, '').send_to_queue()
return tk.redirect_to(dataset_list_url)

Expand Down Expand Up @@ -91,14 +91,17 @@ def subscription_confirmation() -> Response:
hdx_validate_email(email)

token_obj = notification_platform_logic.get_or_generate_email_validation_token(email, dataset_id)
dataset_dict = tk.get_action('package_show')({}, {'id': dataset_id})

subject = u'Please verify your email address'
verify_email_link = _h.url_for(
'hdx_notifications.subscribe_to_dataset',
token=token_obj.token, qualified=True
)
email_data = {
'verify_email_link': verify_email_link
'verify_email_link': verify_email_link,
'dataset_title': dataset_dict.get('title'),
'dataset_id': dataset_id
}
hdx_mailer.mail_recipient([{'email': email}], subject, email_data, footer=None,
snippet='email/content/notification_platform/verify_email.html')
Expand Down

0 comments on commit efec723

Please sign in to comment.