Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account migration #7916

Merged
merged 23 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c7beb2
DD-455 Configurable Account/Password Upgrade Page (#75)
mderuijter May 26, 2021
e4aa309
Merged back develop
janvanmansum May 26, 2021
013d4ac
Merged back develop
janvanmansum Jul 25, 2021
31080a8
Changed method call into bean property access
janvanmansum Jul 25, 2021
4789a36
Merged back develop
janvanmansum Sep 10, 2021
f62b010
changed configuration options to standard behaviour
Sep 16, 2021
796b22b
Merge pull request #120 from mderuijter/dd-602-simplify-account-migra…
janvanmansum Sep 16, 2021
6570716
Merge branch 'develop' into account-migration
janvanmansum Sep 16, 2021
e7eff19
removed update=@all and moved setting of Flash var to the switch in c…
Sep 21, 2021
7dbf83a
Merge pull request #121 from mderuijter/dd-602-simplify-account-migra…
janvanmansum Sep 24, 2021
f87c83e
Merge branch 'develop' into account-migration
janvanmansum Sep 24, 2021
835cdfd
Merge remote-tracking branch 'blessed/account-migration' into account…
janvanmansum Sep 24, 2021
20b91f0
Merge remote-tracking branch 'upstream/develop' into account-migration
Sep 28, 2021
5dea0a6
Merge pull request #122 from mderuijter/account-migration
janvanmansum Sep 28, 2021
0eada12
Restored :PVCustomPasswordResetAlertMessage which was not actually pa…
janvanmansum Oct 1, 2021
1b64eeb
Merge remote-tracking branch 'blessed/account-migration' into account…
janvanmansum Oct 1, 2021
db1b9d1
Merge branch 'develop' into account-migration
janvanmansum Oct 1, 2021
e8714a3
Merge branch 'develop' into account-migration
janvanmansum Oct 22, 2021
8730c3b
Merge branch 'develop' into account-migration
janvanmansum Oct 27, 2021
735418b
Set validationFailed by default to true, to resolve bug, as suggested…
janvanmansum Oct 27, 2021
88bec6b
Merge branch 'develop' into account-migration
janvanmansum Nov 4, 2021
f5c9586
Merge branch 'develop' into account-migration
janvanmansum Nov 9, 2021
c04330c
Merge branch 'develop' into account-migration
janvanmansum Nov 15, 2021
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
3 changes: 3 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean;
import edu.harvard.iq.dataverse.authorization.CredentialsAuthenticationProvider;
import edu.harvard.iq.dataverse.authorization.exceptions.AuthenticationFailedException;
import edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider;
import edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinUserServiceBean;
import edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProvider;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
Expand Down Expand Up @@ -166,6 +167,7 @@ public String login() {
for ( FilledCredential fc : filledCredentialsList ) {
authReq.putCredential(fc.getCredential().getKey(), fc.getValue());
}

authReq.setIpAddress( dvRequestService.getDataverseRequest().getSourceAddress() );
try {
AuthenticatedUser r = authSvc.getUpdateAuthenticatedUser(credentialsAuthProviderId, authReq);
Expand Down Expand Up @@ -205,6 +207,7 @@ public String login() {
logger.log( Level.WARNING, "Error logging in: " + response.getMessage(), response.getError() );
return null;
case BREAKOUT:
FacesContext.getCurrentInstance().getExternalContext().getFlash().put("silentUpgradePasswd",authReq.getCredential(BuiltinAuthenticationProvider.KEY_PASSWORD));
return response.getMessage();
default:
JsfHelper.addErrorMessage("INTERNAL ERROR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class PasswordResetPage implements java.io.Serializable {
String newPassword;

PasswordResetData passwordResetData;

boolean validationFailed = true;

private List<String> passwordErrors;

Expand All @@ -100,6 +102,10 @@ public void init() {
passwordResetData = passwordResetExecResponse.getPasswordResetData();
if (passwordResetData != null) {
user = passwordResetData.getBuiltinUser();
if (passwordResetData.getReason().equals(PasswordResetData.Reason.UPGRADE_REQUIRED)){
newPassword = (String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("silentUpgradePasswd");
validationFailed = false;
}
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
BundleUtil.getStringFromBundle("passwdVal.passwdReset.resetLinkTitle"),
Expand Down Expand Up @@ -143,6 +149,7 @@ public String sendPasswordResetLink() {

public String resetPassword() {
PasswordChangeAttemptResponse response = passwordResetService.attemptPasswordReset(user, newPassword, this.token);
validationFailed = response.getMessageDetail().contains("Password Reset Problem");
if (response.isChanged()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, response.getMessageSummary(), response.getMessageDetail()));
String builtinAuthProviderId = BuiltinAuthenticationProvider.PROVIDER_ID;
Expand Down Expand Up @@ -198,6 +205,10 @@ public void setToken(String token) {
this.token = token;
}

public boolean isFailedValidation(){
return validationFailed;
}

public BuiltinUser getUser() {
return user;
}
Expand Down Expand Up @@ -234,14 +245,13 @@ public String getGoodPasswordDescription() {
// FIXME: Pass the errors in.
return passwordValidatorService.getGoodPasswordDescription(null);
}

public String getCustomPasswordResetAlertMessage() {
String customPasswordResetAlertMessage = settingsWrapper.getValueForKey(SettingsServiceBean.Key.PVCustomPasswordResetAlertMessage);
if(customPasswordResetAlertMessage != null && !customPasswordResetAlertMessage.isEmpty()){
return customPasswordResetAlertMessage;
} else {
String defaultPasswordResetAlertMessage = BundleUtil.getStringFromBundle("passwdReset.newPasswd.details");
return defaultPasswordResetAlertMessage;
return BundleUtil.getStringFromBundle("passwdReset.newPasswd.details");
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ user.acccountterms.required=Please check the box to indicate your acceptance of
user.acccountterms.iagree=I have read and accept the Dataverse General Terms of Use as outlined above.
user.createBtn=Create Account
user.updatePassword.welcome=Welcome to Dataverse {0}
user.updatePassword.warning=With the release of our new Dataverse 4.0 upgrade, the password requirements and General Terms of Use have updated. As this is the first time you are using Dataverse since the update, you need to create a new password and agree to the new General Terms of Use.
user.updatePassword.warning=Our terms of use have changed, please check the box below and click Continue.
user.updatePassword.password={0}
user.password=Password
user.newPassword=New Password
Expand Down Expand Up @@ -307,10 +307,10 @@ passwdReset.debug=DEBUG
passwdReset.resetUrl=The reset URL is
passwdReset.noEmail.tip=No email was actually sent because a user could not be found using the provided email address {0} but we don't mention this because we don't malicious users to use the form to determine if there is an account associated with an email address.
passwdReset.illegalLink.tip=Your password reset link is not valid. If you need to reset your password, {0}click here{1} in order to request that your password to be reset again.
passwdReset.newPasswd.details={0} Reset Password{1} \u2013 Our password requirements have changed. Please pick a strong password that matches the criteria below.
passwdReset.newPasswd.details=Please, accept the new terms of use before continuing.
passwdReset.newPasswd=New Password
passwdReset.rePasswd=Retype Password
passwdReset.resetBtn=Reset Password
passwdReset.resetBtn=Continue

#loginpage.xhtml
login.System=Login System
Expand Down
9 changes: 4 additions & 5 deletions src/main/webapp/passwordreset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
</div>
<div class="form-group col-sm-11">
<div class="col-sm-offset-3 col-sm-9 button-block">
<p:commandButton styleClass="btn btn-default" action="#{PasswordResetPage.sendPasswordResetLink()}" update="passwordReset,:messagePanel"
value="#{bundle['passwdReset.submitRequest']}"/>
<p:commandButton styleClass="btn btn-default" action="#{PasswordResetPage.sendPasswordResetLink()}" update="passwordReset,:messagePanel" value="#{bundle['passwdReset.submitRequest']}"/>
<p:button styleClass="btn btn-link" value="#{bundle.cancel}" outcome="/loginpage.xhtml"/>
</div>
</div>
Expand Down Expand Up @@ -93,7 +92,7 @@
<ui:fragment rendered="#{not empty PasswordResetPage.user}">
<div class="alert alert-info">
<span class="glyphicon glyphicon-info-sign"></span>
<h:outputFormat value="#{PasswordResetPage.customPasswordResetAlertMessage}" escape="false">
<h:outputFormat value="#{PasswordResetPage.customPasswordResetAlertMessage}" escape="false">
<f:param value="&lt;strong&gt;"/>
<f:param value="&lt;/strong&gt;"/>
</h:outputFormat>
Expand All @@ -109,7 +108,7 @@
<div>
<h:form id="passwordResetForm" styleClass="form-horizontal">
<p:focus context="passwordResetForm"/>
<div class="form-group col-sm-11">
<div class="form-group col-sm-11" jsf:rendered="#{PasswordResetPage.failedValidation}">
<label for="inputPassword" class="col-sm-3 control-label">
#{bundle['passwdReset.newPasswd']} <span class="glyphicon glyphicon-asterisk text-danger" title="#{bundle.requiredField}"></span>
</label>
Expand All @@ -125,7 +124,7 @@
<p:message for="inputPassword"/>
</div>
</div>
<div class="form-group col-sm-11">
<div class="form-group col-sm-11" jsf:rendered="#{PasswordResetPage.failedValidation}">
<label for="retypePassword" class="col-sm-3 control-label">
#{bundle['passwdReset.rePasswd']} <span class="glyphicon glyphicon-asterisk text-danger" title="#{bundle.requiredField}"></span>
</label>
Expand Down