mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
resolved review comments
This commit is contained in:
@@ -373,7 +373,7 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
|
||||
final ClientApp clientApp = getClientAppConfig(clientName);
|
||||
Map<String, Serializable> emailTemplateModel = Collections.singletonMap(FTL_RESET_PASSWORD_URL,
|
||||
createResetPasswordUrl(clientApp, id, key, userName));
|
||||
createResetPasswordUrl(clientApp, id, key));
|
||||
|
||||
final String templatePath = emailHelper.getEmailTemplate(clientName,
|
||||
getResetPasswordEmailTemplate(clientApp),
|
||||
@@ -504,7 +504,7 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
return UrlUtil.replaceShareUrlPlaceholder(url, sysAdminParams);
|
||||
}
|
||||
|
||||
private String getAdwUrl(String url, String propName)
|
||||
private String getRepoBaseUrl(String url, String propName)
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
@@ -516,7 +516,7 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
{
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
return UrlUtil.replaceAdwUrlPlaceholder(url, sysAdminParams);
|
||||
return UrlUtil.replaceRepoBaseUrlPlaceholder(url, sysAdminParams);
|
||||
}
|
||||
|
||||
protected String getResetPasswordEmailTemplate(ClientApp clientApp)
|
||||
@@ -532,17 +532,21 @@ public class ResetPasswordServiceImpl implements ResetPasswordService
|
||||
/**
|
||||
* This method creates a URL for the 'reset password' link which appears in the email
|
||||
*/
|
||||
protected String createResetPasswordUrl(ClientApp clientApp, final String id, final String key, final String userName)
|
||||
protected String createResetPasswordUrl(ClientApp clientApp, final String id, final String key)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
|
||||
String pageUrl = clientApp.getProperty("resetPasswordPageUrl");
|
||||
|
||||
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);
|
||||
if(clientApp.getName().equals("workspace"))
|
||||
{
|
||||
String workspaceUrl = clientApp.getProperty("workspaceUrl");
|
||||
|
||||
sb.append(getRepoBaseUrl(workspaceUrl,""));
|
||||
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));
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
@@ -41,6 +41,10 @@ public class UrlUtil
|
||||
public static final Pattern PATTERN = Pattern.compile("\\$\\{shareUrl\\}");
|
||||
// ${alfrescoUrl} placeholder
|
||||
public static final Pattern REPO_PATTERN = Pattern.compile("\\$\\{alfrescoUrl\\}");
|
||||
|
||||
public static final Pattern WORKSPACE_PATTERN = Pattern.compile("\\$\\{repoBaseUrl\\}");
|
||||
|
||||
|
||||
/**
|
||||
* Builds up the Url to Alfresco based on the settings in the
|
||||
* {@link SysAdminParams}.
|
||||
@@ -153,29 +157,28 @@ public class UrlUtil
|
||||
* @return Adw Url such as https://col.ab.or.ate/#/
|
||||
* or http://localhost:8081/#/
|
||||
*/
|
||||
public static String getAdwUrl(SysAdminParams sysAdminParams)
|
||||
public static String getWorkspaceUrl(SysAdminParams sysAdminParams)
|
||||
{
|
||||
return buildUrl(
|
||||
sysAdminParams.getAlfrescoProtocol(),
|
||||
sysAdminParams.getAlfrescoHost(),
|
||||
sysAdminParams.getAlfrescoPort(),
|
||||
"#");
|
||||
sysAdminParams.getAlfrescoPort(),"");
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the adw url placeholder, namely {@literal ${alfrescoUrl}}, with <b>adw</b> url.
|
||||
* Replaces the repo base url placeholder, namely {@literal ${repoBaseUrl}}, with <b>workspace</b> url.
|
||||
*
|
||||
* @param value the string value which contains the share url placeholder
|
||||
* @param value the string value which contains the repoBase 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)
|
||||
public static String replaceRepoBaseUrlPlaceholder(String value, SysAdminParams sysAdminParams)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
return REPO_PATTERN.matcher(value).replaceAll(getAdwUrl(sysAdminParams));
|
||||
return WORKSPACE_PATTERN.matcher(value).replaceAll(getWorkspaceUrl(sysAdminParams));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@@ -20,13 +20,17 @@ repo.client-app.share.resetPasswordPageUrl=${shareUrl}/page/reset-password
|
||||
repo.client-app.share.confirmResetPasswordTemplatePath=
|
||||
|
||||
### Digital workspace template configurations
|
||||
repo.client-app.workspace.inviteModeratedTemplatePath=
|
||||
repo.client-app.workspace.workspaceUrl=workspace
|
||||
repo.client-app.workspace.templateAssetsUrl=${alfrescoUrl}/images
|
||||
#repo.client-app.workspace.inviteModeratedTemplatePath=
|
||||
|
||||
repo.client-app.workspace.workspaceUrl=${repoBaseUrl}/workspace
|
||||
|
||||
###########repo.client-app.workspace.workspaceUrl=http://customdomain.com/workspace
|
||||
|
||||
repo.client-app.workspace.templateAssetsUrl=${workspaceUrl}/images
|
||||
|
||||
# reset password request email template path
|
||||
repo.client-app.adw.requestResetPasswordTemplatePath=alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl
|
||||
repo.client-app.workspace.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/
|
||||
repo.client-app.workspace.resetPasswordPageUrl=${workspaceUrl}/reset-password/
|
||||
# reset password confirmation email template path
|
||||
repo.client-app.adw.confirmResetPasswordTemplatePath=
|
||||
repo.client-app.workspace.confirmResetPasswordTemplatePath=
|
Reference in New Issue
Block a user