mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
ACA-4619: Forgot Password Changes
This commit is contained in:
@@ -504,6 +504,21 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
return UrlUtil.replaceShareUrlPlaceholder(url, sysAdminParams);
|
||||
}
|
||||
|
||||
private String getAdwUrl(String url, String propName)
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
LOGGER.warn("The url for the property [" + propName + "] is not configured.");
|
||||
return "";
|
||||
}
|
||||
|
||||
if (url.endsWith("/"))
|
||||
{
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
return UrlUtil.replaceAdwUrlPlaceholder(url, sysAdminParams);
|
||||
}
|
||||
|
||||
protected String getResetPasswordEmailTemplate(ClientApp clientApp)
|
||||
{
|
||||
return clientApp.getProperty("requestResetPasswordTemplatePath");
|
||||
@@ -522,22 +537,28 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
|
||||
String pageUrl = clientApp.getProperty("resetPasswordPageUrl");
|
||||
if (StringUtils.isEmpty(pageUrl))
|
||||
{
|
||||
sb.append(UrlUtil.getShareUrl(sysAdminParams));
|
||||
|
||||
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
|
||||
if(clientApp.getName().equals("adw")) {
|
||||
sb.append(getAdwUrl(pageUrl, ""));
|
||||
LOGGER.warn("Client Name is " + clientApp.getName() + " The url used is " + sb.toString());
|
||||
sb.append("?key=").append(key)
|
||||
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id)).append("&userName=").append(userName);
|
||||
|
||||
}
|
||||
else {
|
||||
if (StringUtils.isEmpty(pageUrl)) {
|
||||
sb.append(UrlUtil.getShareUrl(sysAdminParams));
|
||||
|
||||
LOGGER.warn("'resetPasswordPageUrl' property is not set for the client [" + clientApp.getName()
|
||||
+ "]. The default base url of Share will be used [" + sb.toString() + "]");
|
||||
}
|
||||
else
|
||||
{
|
||||
// We pass an empty string as we know that the pageUrl is not null
|
||||
sb.append(getUrl(pageUrl, ""));
|
||||
}
|
||||
} else {
|
||||
// We pass an empty string as we know that the pageUrl is not null
|
||||
sb.append(getUrl(pageUrl, ""));
|
||||
}
|
||||
|
||||
sb.append("?key=").append(key)
|
||||
sb.append("?key=").append(key)
|
||||
.append("&id=").append(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, id));
|
||||
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
@@ -146,4 +146,38 @@ public class UrlUtil
|
||||
url.append(context);
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds up the Url to Adw based on the settings in the
|
||||
* {@link SysAdminParams}.
|
||||
* @return Adw Url such as https://col.ab.or.ate/#/
|
||||
* or http://localhost:8081/#/
|
||||
*/
|
||||
public static String getAdwUrl(SysAdminParams sysAdminParams)
|
||||
{
|
||||
return buildUrl(
|
||||
sysAdminParams.getAlfrescoProtocol(),
|
||||
sysAdminParams.getAlfrescoHost(),
|
||||
sysAdminParams.getAlfrescoPort(),
|
||||
"#");
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the adw url placeholder, namely {@literal ${alfrescoUrl}}, with <b>adw</b> url.
|
||||
*
|
||||
* @param value the string value which contains the share url placeholder
|
||||
* @param sysAdminParams the {@code SysAdminParams} object
|
||||
* @return if the given {@code value} contains share url placeholder,
|
||||
* the placeholder is replaced with share url; otherwise, the given {@code value} is simply returned
|
||||
*/
|
||||
|
||||
public static String replaceAdwUrlPlaceholder(String value, SysAdminParams sysAdminParams)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
return REPO_PATTERN.matcher(value).replaceAll(getAdwUrl(sysAdminParams));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,3 +23,10 @@ repo.client-app.share.confirmResetPasswordTemplatePath=
|
||||
repo.client-app.workspace.inviteModeratedTemplatePath=
|
||||
repo.client-app.workspace.workspaceUrl=workspace
|
||||
repo.client-app.workspace.templateAssetsUrl=${alfrescoUrl}/images
|
||||
|
||||
# reset password request email template path
|
||||
repo.client-app.adw.requestResetPasswordTemplatePath=alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl
|
||||
# reset password UI page url
|
||||
repo.client-app.adw.resetPasswordPageUrl=${alfrescoUrl}/reset-password/
|
||||
# reset password confirmation email template path
|
||||
repo.client-app.adw.confirmResetPasswordTemplatePath=
|
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Forgot Password</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>You are receiving this email because you(or someone else) requested the password reset of your account.</p>
|
||||
<p>Please click on the following link, or paste this url into your browser to complete the process:</p>
|
||||
<p><a href="${reset_password_url}">${reset_password_url}</a></p>
|
||||
<p>If you received this in error, you can safely ignore it.</p>
|
||||
<p>Kind regards</p>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user