Skip to content

Commit

Permalink
Working on remider emails, refactoring code so we get the primary ema…
Browse files Browse the repository at this point in the history
…il information along with the email and orcid id
  • Loading branch information
amontenegro committed Nov 1, 2023
1 parent f7e4a2c commit 02e1220
Show file tree
Hide file tree
Showing 19 changed files with 143 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,14 @@ public class VerifyEmailUtils {
@Resource
private EncryptionManager encryptionManager;

public Map<String, Object> createParamsForVerificationEmail(String emailFriendlyName, String orcid, String email, String primaryEmail, Locale locale) {
public Map<String, Object> createParamsForVerificationEmail(String emailFriendlyName, String orcid, String email, boolean isPrimary, Locale locale) {
Map<String, Object> templateParams = new HashMap<String, Object>();

String subject = getSubject(primaryEmail.equalsIgnoreCase(email) ? "email.subject.verify_reminder_primary" : "email.subject.verify_reminder", locale);

templateParams.put("primaryEmail", primaryEmail);
templateParams.put("isPrimary", primaryEmail.equalsIgnoreCase(email));
templateParams.put("emailName", emailFriendlyName);
String verificationUrl = createVerificationUrl(email, orcidUrlManager.getBaseUrl());
templateParams.put("verificationUrl", verificationUrl);
templateParams.put("isPrimary", isPrimary);
templateParams.put("userName", emailFriendlyName);
templateParams.put("verificationUrl", createVerificationUrl(email, orcidUrlManager.getBaseUrl()));
templateParams.put("orcid", orcid);
templateParams.put("email", email);
templateParams.put("subject", subject);
templateParams.put("baseUri", orcidUrlManager.getBaseUrl());
templateParams.put("baseUriHttp", orcidUrlManager.getBaseUriHttp());
templateParams.put("subject", getSubject((isPrimary ? "email.subject.verify_reminder_primary" : "email.subject.verify_reminder"), locale));
templateParams.put("baseUri", orcidUrlManager.getBaseUrl());
addMessageParams(templateParams, locale);
return templateParams;
}
Expand Down
3 changes: 3 additions & 0 deletions orcid-core/src/main/resources/i18n/email_common_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ email.common.privacy_policy=privacy policy
email.common.address1=ORCID, Inc.
email.common.address2=10411 Motor City Drive, Suite 750, Bethesda, MD 20817, USA
email.common.received_email_as_service=You have received this email as a service announcement related to your ORCID Account.

email.welcome.your_id.id=Your ORCID iD:
email.welcome.your_id.link=Your ORCID record is
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# NotificaionManager.java

email.subject.verify_reminder=[ORCID] Verify your email address
email.subject.verify_reminder_primary=[ORCID] Reminder to verify your primary email address
email.subject.verify_reminder_primary=[ORCID] Don't forget to verify your email address
email.subject.reset=[ORCID] About your password reset request
email.subject.forgotten_id=[ORCID] Your ORCID iD
email.subject.reset_not_found=[ORCID] Email address not found
Expand Down
15 changes: 3 additions & 12 deletions orcid-core/src/main/resources/i18n/email_verify_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
## Used on:
# verification_email

email.verify.primary_reminder_v2=This is a reminder that you need to verify your primary email address before you can begin adding information such as your affiliation, biography, or keywords manually to your ORCID record.
email.verify.primary_reminder=This is a reminder that you need to verify your primary email address before you can begin adding information manually to your ORCID record.
email.verify.thank_you=To verify your email address, click the following link and sign into your ORCID record. If you can't click the link, copy and paste it into your browser's address bar:
email.verify.thank_you_button=To verify your email address, click the following button and sign into your ORCID record. If you can't click the button, copy and paste the link below into your browser's address bar:
#${verificationUrl}
email.verify.1=Your 16-digit ORCID identifier is
#${orcid}
email.verify.2=, and your full ORCID iD and the link to your public record is
#${pubBaseUri}/${orcid}
email.verify.primary_email_1=(primary email address:
email.verify.primary_email_2=)
email.verify.if_you_did_not=If you did not add this email address to your ORCID record, please contact us immediately by replying to this email.
email.verify.hi=Hi
email.verify.primary.reminder=This is a friendly reminder to verify your email address in your ORCID record so that you can unlock advanced editing features in your ORCID record. Until then, you will only be able to manage your names and email addresses in your ORCID record.
email.verify.alternate.reminder=You need to verify your email address.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ email.button=Verify your email address
email.welcome=Welcome to ORCID
email.welcome.congrats=Congratulations on creating your new ORCID iD! This persistent digital identifier, that you own and control, will distinguish you from every other researcher and reduce your burden when you use it in manuscript and grant submission systems.
email.welcome.for_more_information=for more information on how to get the most out of your ORCID record.
email.welcome.please_visit_your=Please visit our
email.welcome.please_visit_our=Please visit our
email.welcome.researcher_homepage=researcher homepage
email.welcome.verify.1=Verifying your email address unlocks advanced editing features in your ORCID record. Until then you will only be able to manage your names and email addresses in your ORCID record.
email.welcome.verify.2=How do I verify my email address?
email.welcome.verify.3=Simply click the button below to sign into your ORCID record and complete verification.
email.welcome.verify.4=Or, copy and paste the link below into your browser's address bar:
email.welcome.visit=Please visit our researcher homepage for more information on how to get the most out of your ORCID record.
email.welcome.your_id.id=Your ORCID iD:
email.welcome.your_id.link=Your ORCID record is
email.welcome.visit=Please visit our researcher homepage for more information on how to get the most out of your ORCID record.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.verify.1" />
</p>
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<b><@emailMacros.msg "email.welcome.verify.2" /></b><br />
<@emailMacros.msg "email.welcome.verify.3" />
<table cellpadding="0" cellspacing="0" style="font-family: Helvetica, Arial, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; margin-top:20px">
<tbody>
<tr>
<td style="border-spacing: 0px; border-collapse: collapse; line-height: 24px; font-size: 16px; border-radius: 4px; margin: 0;">
<a id="verificationButton"
href="${verificationUrl}?lang=${locale}"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; text-decoration: none; border-radius: 4.8px; line-height: 25px; display: inline-block; font-weight: normal; white-space: nowrap; background-color: #31789B; color: #ffffff; padding: 8px 16px; border: 1px solid #31789B;"
><@emailMacros.msg "email.button" /></a>
</td>
</tr>
</tbody>
</table>
</p>
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.verify.4" />
<table cellpadding="0" cellspacing="0" style="font-family: arial, helvetica, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; ">
<tbody>
<tr>
<td>
<p align="center" class="text-center" style="line-height: 24px; font-size: 16px; margin: 0; padding-bottom: 30px; padding-top: 20px; word-break: break-word;">
<a id="verificationUrl"
href="${verificationUrl}?lang=${locale}"
target="orcid.blank"
>${verificationUrl}?lang=${locale}</a>
</p>
</td>
</tr>
</tbody>
</table>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,31 @@
<#escape x as x?html>
<!DOCTYPE html>
<html>
<head>
<title>${subject}</title>
</head>
<body>
<div style="padding: 20px; padding-top: 10px; margin: auto;">
<img src="https://orcid.org/sites/all/themes/orcid/img/orcid-logo.png" alt="ORCID.org"/>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<#if isPrimary?? && isPrimary>
<@emailMacros.msg "email.verify.primary_reminder_v2" /><@emailMacros.space />
</#if>
<@emailMacros.msg "email.verify.thank_you_button" />
<head>
<title>${subject}</title>
</head>
<body>
<div style="padding: 20px; padding-top: 10px; margin: auto;">
<img src="https://orcid.org/sites/all/themes/orcid/img/orcid-logo.png" alt="ORCID.org"/>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.your_id.id" /><@emailMacros.space />${orcidId}<br/>
<@emailMacros.msg "email.welcome.your_id.link" /><@emailMacros.space /><a href="${baseUri}/${orcidId}" target="orcid.blank">${baseUri}/${orcidId}</a>
</p>
<table
cellpadding="0"
cellspacing="0"
style="font-family: Helvetica, Arial, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; margin-top:20px"
>
<tbody>
<tr>
<td
style="border-spacing: 0px; border-collapse: collapse; line-height: 24px; font-size: 16px; border-radius: 4px; margin: 0;"
>
<a
id="verificationButton"
href="${verificationUrl}?lang=${locale}"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; text-decoration: none; border-radius: 4.8px; line-height: 25px; display: inline-block; font-weight: normal; white-space: nowrap; background-color: #31789B; color: #ffffff; padding: 8px 16px; border: 1px solid #31789B;"
> <@emailMacros.msg "email.button" /></a
>
</td>
</tr>
</tbody>
</table>

<table
cellpadding="0"
cellspacing="0"
style="font-family: arial, helvetica, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; "
>
<tbody>
<tr>
<td>
<p
align="center"
class="text-center"
style="line-height: 24px; font-size: 16px; margin: 0; padding-bottom: 30px; padding-top: 20px; word-break: break-word;"
>
<a
id="verificationUrl"
href="${verificationUrl}?lang=${locale}"
target="orcid.blank"
>${verificationUrl}?lang=${locale}</a
>
</p>
</td>
</tr>
</tbody>
</table>

<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<@emailMacros.msg "email.verify.1" /><@emailMacros.space />${orcid}<@emailMacros.msg "email.verify.2" /><@emailMacros.space /><a href="${baseUri}/${orcid}?lang=${locale}" target="orcid.blank">${baseUri}/${orcid}</a><@emailMacros.space /><@emailMacros.msg "email.verify.primary_email_1" /><@emailMacros.space />${primaryEmail}<@emailMacros.msg "email.verify.primary_email_2" />.
</p>
<#include "email_footer_html.ftl"/>
</div>
</body>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.verify.hi" /><@emailMacros.space />${userName},<br/>
<#if isPrimary?? && isPrimary><@emailMacros.msg "email.verify.primary.reminder" /><#elseif><@emailMacros.msg "email.verify.alternate.reminder" /></#if>
</p>
<#include "how_do_i_verify_my_email_address_html.ftl"/>
<hr />
<#if isPrimary?? && isPrimary>
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.please_visit_our" /><@emailMacros.space /><a href="https://info.orcid.org/researchers/" target="orcid.blank"><@emailMacros.msg "email.welcome.researcher_homepage" /></a><@emailMacros.space /><@emailMacros.msg "email.welcome.for_more_information" />
</p>
</#if>
<#include "email_footer_html.ftl"/>
</div>
</body>
</html>
</#escape>
Original file line number Diff line number Diff line change
Expand Up @@ -27,74 +27,19 @@
<div style="padding: 20px; padding-top: 10px; margin: auto;">
<img src="https://orcid.org/sites/all/themes/orcid/img/orcid-logo.png" alt="ORCID.org"/>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.your_id.id" /><@emailMacros.space />${orcidId}<br/>
<@emailMacros.msg "email.welcome.your_id.link" /><@emailMacros.space /><a href="${baseUri}/${orcidId}" target="orcid.blank">${baseUri}/${orcidId}</a>
</p>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome" /><@emailMacros.space />${userName},<br/>
<@emailMacros.msg "email.welcome.congrats" />
</p>
<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<@emailMacros.msg "email.welcome.verify.1" />
</p>

<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<b><@emailMacros.msg "email.welcome.verify.2" /></b><br />
<@emailMacros.msg "email.welcome.verify.3" />
<table
cellpadding="0"
cellspacing="0"
style="font-family: Helvetica, Arial, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; margin-top:20px"
>
<tbody>
<tr>
<td
style="border-spacing: 0px; border-collapse: collapse; line-height: 24px; font-size: 16px; border-radius: 4px; margin: 0;"
>
<a
id="verificationButton"
href="${verificationUrl}?lang=${locale}"
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; text-decoration: none; border-radius: 4.8px; line-height: 25px; display: inline-block; font-weight: normal; white-space: nowrap; background-color: #31789B; color: #ffffff; padding: 8px 16px; border: 1px solid #31789B;"
> <@emailMacros.msg "email.button" /></a
>
</td>
</tr>
</tbody>
</table>
</p>

<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<@emailMacros.msg "email.welcome.verify.4" />
<table
cellpadding="0"
cellspacing="0"
style="font-family: arial, helvetica, sans-serif; border-spacing: 0px; border-collapse: separate !important; border-radius: 4px; margin: 0 auto; "
>
<tbody>
<tr>
<td>
<p
align="center"
class="text-center"
style="line-height: 24px; font-size: 16px; margin: 0; padding-bottom: 30px; padding-top: 20px; word-break: break-word;"
>
<a
id="verificationUrl"
href="${verificationUrl}?lang=${locale}"
target="orcid.blank"
>${verificationUrl}?lang=${locale}</a
>
</p>
</td>
</tr>
</tbody>
</table>
</p>
<#include "how_do_i_verify_my_email_address_html.ftl"/>
<hr />
<p style="font-family: arial, helvetica, sans-serif; font-size: 15px; color: #494A4C;">
<@emailMacros.msg "email.welcome.please_visit_your" /><@emailMacros.space /><a href="https://info.orcid.org/researchers/" target="orcid.blank"><@emailMacros.msg "email.welcome.researcher_homepage" /></a><@emailMacros.space /><@emailMacros.msg "email.welcome.for_more_information" />
<p style="font-family: arial, helvetica, sans-serif; font-size: 16px; color: #494A4C;">
<@emailMacros.msg "email.welcome.please_visit_our" /><@emailMacros.space /><a href="https://info.orcid.org/researchers/" target="orcid.blank"><@emailMacros.msg "email.welcome.researcher_homepage" /></a><@emailMacros.space /><@emailMacros.msg "email.welcome.for_more_information" />
</p>
<#include "email_footer_html.ftl"/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@

${verificationUrl}?lang=${locale}

<@emailMacros.msg "email.welcome.please_visit_your" /><@emailMacros.space /><@emailMacros.msg "email.welcome.researcher_homepage" /><@emailMacros.space /><@emailMacros.msg "email.welcome.for_more_information" />
<@emailMacros.msg "email.welcome.please_visit_our" /><@emailMacros.space /><@emailMacros.msg "email.welcome.researcher_homepage" /><@emailMacros.space /><@emailMacros.msg "email.welcome.for_more_information" />

<#include "email_footer.ftl"/>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import org.orcid.persistence.jpa.entities.EmailEventType;
import org.orcid.persistence.jpa.entities.IndexingStatus;
import org.orcid.persistence.jpa.entities.OrcidGrantedAuthority;
Expand Down Expand Up @@ -76,10 +76,8 @@ public interface ProfileDao extends GenericDao<ProfileEntity, String> {

void updateLastModifiedDateAndIndexingStatusWithoutResult(String orcid, Date lastModified, IndexingStatus indexingStatus);

public List<Pair<String, Date>> findEmailsUnverfiedDays(int daysUnverified, int maxResults);
public List<Triple<String, Boolean, Date>> findEmailsUnverfiedDays(int daysUnverified, int maxResults);

public List<Pair<String, Date>> findEmailsUnverifiedDaysAndEventType(int daysUnverified, int maxResults, List<EmailEventType> eventTypes);

String retrieveOrcidType(String orcid);

List<Object[]> findInfoForDecryptionAnalysis();
Expand Down
Loading

0 comments on commit 02e1220

Please sign in to comment.