Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Migrate all the hardcoded message and email strings to properties file for password reset service. See #12536.
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,22 @@ public void deleteResetDataByDataverseUser(BuiltinUser user) {

public PasswordChangeAttemptResponse attemptPasswordReset(BuiltinUser user, String newPassword, String token) {

final String messageSummarySuccess = "Password Reset Successfully";
final String messageSummarySuccess = BundleUtil.getStringFromBundle("passwdReset.messageSummarySuccess");
final String messageDetailSuccess = "";

// optimistic defaults :)
String messageSummary = messageSummarySuccess;
String messageDetail = messageDetailSuccess;

final String messageSummaryFail = "Password Reset Problem";
final String messageSummaryFail = BundleUtil.getStringFromBundle("passwdReset.messageSummaryFail");
if (user == null) {
messageSummary = messageSummaryFail;
messageDetail = "User could not be found.";
messageDetail = BundleUtil.getStringFromBundle("passwdReset.failDetail.userNotFound");
return new PasswordChangeAttemptResponse(false, messageSummary, messageDetail);
}
if (newPassword == null) {
messageSummary = messageSummaryFail;
messageDetail = "New password not provided.";
messageDetail = BundleUtil.getStringFromBundle("passwdReset.failDetail.passwordNotProvided");
return new PasswordChangeAttemptResponse(false, messageSummary, messageDetail);
}
if (token == null) {
Expand Down Expand Up @@ -248,17 +248,17 @@ public PasswordChangeAttemptResponse attemptPasswordReset(BuiltinUser user, Stri
}
AuthenticatedUser authUser = authService.getAuthenticatedUser(user.getUserName());

String toAddress = authUser.getEmail();
String subject = "Dataverse Password Reset Successfully Changed";
String pattern = BundleUtil.getStringFromBundle("notification.email.passwordResetCompleted");
String[] paramArray = {authUser.getName() };
String messageBody = MessageFormat.format(pattern, paramArray);

String messageBody = "Hi " + authUser.getName() + ",\n\n"
+ "Your Dataverse account password was successfully changed.\n\n"
+ "Please contact us if you did not request this password reset or need further help.\n\n";
String toAddress = authUser.getEmail();
String subject = BundleUtil.getStringFromBundle("notification.email.passwordResetCompleted.subject");
mailService.sendSystemEmail(toAddress, subject, messageBody);
return new PasswordChangeAttemptResponse(true, messageSummary, messageDetail);
} else {
messageSummary = messageSummaryFail;
messageDetail = "Your password was not reset. Please contact support.";
messageDetail = BundleUtil.getStringFromBundle("passwdReset.failDetail.generic");
logger.info("Enable to save user " + user.getId());
return new PasswordChangeAttemptResponse(false, messageSummary, messageDetail);
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ passwdReset.newPasswd.details=Please pick a strong password that matches the cri
passwdReset.newPasswd=New Password
passwdReset.rePasswd=Retype Password
passwdReset.resetBtn=Continue
passwdReset.messageSummarySuccess=Password Reset Successfully
passwdReset.messageSummaryFail=Password Reset Problem
passwdReset.failDetail.userNotFound=User could not be found.
passwdReset.failDetail.passwordNotProvided=New password not provided.
passwdReset.failDetail.generic=Your password was not reset. Please contact support.

#loginpage.xhtml
login.System=Login System
Expand Down Expand Up @@ -871,6 +876,8 @@ notification.email.revokeRole=One of your roles for the {0} "{1}" has been revok
notification.email.changeEmail=Hello, {0}.{1}\n\nPlease contact us if you did not intend this change or if you need assistance.
notification.email.passwordReset=Hi {0},\n\nSomeone, hopefully you, requested a password reset for {1}.\n\nPlease click the link below to reset your Dataverse account password:\n\n {2} \n\n The link above will only work for the next {3} minutes.\n\n Please contact us if you did not request this password reset or need further help.
notification.email.passwordReset.subject=Dataverse Password Reset Requested
notification.email.passwordResetCompleted=Hi {0},\n\nYour Dataverse account password was successfully changed.\n\nPlease contact us if you did not request this password reset or need further help.
notification.email.passwordResetCompleted.subject=Dataverse Password Reset Successfully Changed
notification.email.datasetWasCreated=Dataset "<a href = "{0}">{1}</a>" was just created by {2} in the {3} collection.
notification.email.datasetWasMoved=Dataset "<a href = "{0}">{1}</a>" was just moved by {2} to the {3} collection.
notification.email.requestedFileAccess=You have requested access to a file(s) in dataset "<a href = "{0}">{1}</a>". Your request has been sent to the managers of this dataset who will grant or reject your request. If you have any questions, you may reach the dataset managers using the "Contact" link on the upper right corner of the dataset page.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just putting this at the bottom.

At https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-12544/1/consoleFull there was an unrelated failure:

TASK [dataverse : install docker-ce repo] **************************************
fatal: [localhost]: FAILED! => {"changed": false, "dest": "/etc/yum.repos.d/docker-ce.repo", "elapsed": 0, "gid": 0, "group": "root", "mode": "0644", "msg": "Connection failure: [ASN1: NOT_ENOUGH_DATA] not enough data (_ssl.c:4192)", "owner": "root", "secontext": "system_u:object_r:system_conf_t:s0", "size": 811, "state": "file", "uid": 0, "url": "https://download.docker.com/linux/centos/docker-ce.repo"}

I kicked off https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-12544/2/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @pdurbin Thanks for looking into the PR. You want the new properties added to the bottom of the file Bundle.properties?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mahendrapaipuri thanks for the PR! No, where you put them is fine. Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This week we actually turned off the Jenkins job. We switched to GitHub Actions. So I'll merge or rebase the branch, which should remove any report from Jenkins from this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Running. Oh, I also just noticed that because @mahendrapaipuri is a new contributor, GitHub Actions hadn't run. I just clicked the button the approve them. I'll move this PR back to "In Review" until those test pass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing so I moved this PR back to "Ready for QA".

Expand Down
Loading