diff --git a/repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java b/repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java index 800c1cb1d4..530002af89 100644 --- a/repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java +++ b/repository/src/main/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImpl.java @@ -504,21 +504,6 @@ public class ResetPasswordServiceImpl implements ResetPasswordService return UrlUtil.replaceShareUrlPlaceholder(url, sysAdminParams); } - private String getRepoBaseUrl(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.replaceRepoBaseUrlPlaceholder(url, sysAdminParams); - } - protected String getResetPasswordEmailTemplate(ClientApp clientApp) { return clientApp.getProperty("requestResetPasswordTemplatePath"); @@ -537,16 +522,7 @@ public class ResetPasswordServiceImpl implements ResetPasswordService StringBuilder sb = new StringBuilder(100); String pageUrl = clientApp.getProperty("resetPasswordPageUrl"); - - if(!StringUtils.isEmpty(clientApp.getProperty("workspaceUrl"))) - { - String workspaceUrlPlaceholder = clientApp.getProperty("workspaceUrl"); - String workSpaceUrl = getRepoBaseUrl(workspaceUrlPlaceholder,""); - sb.append(UrlUtil.replaceWorkSpaceUrlPlaceholder(pageUrl,workSpaceUrl)); - LOGGER.warn("Client Name is " + clientApp.getName() + " The url used is " + sb.toString()); - - } - else if(StringUtils.isEmpty(pageUrl)) + if (StringUtils.isEmpty(pageUrl)) { sb.append(UrlUtil.getShareUrl(sysAdminParams)); @@ -559,7 +535,7 @@ public class ResetPasswordServiceImpl implements ResetPasswordService 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(); diff --git a/repository/src/main/java/org/alfresco/util/UrlUtil.java b/repository/src/main/java/org/alfresco/util/UrlUtil.java index acb5902009..f040c31858 100644 --- a/repository/src/main/java/org/alfresco/util/UrlUtil.java +++ b/repository/src/main/java/org/alfresco/util/UrlUtil.java @@ -41,12 +41,6 @@ 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 REPOBASE_PATTERN = Pattern.compile("\\$\\{repoBaseUrl\\}"); - - public static final Pattern WORKSPACE_PATTERN = Pattern.compile("\\$\\{workspaceUrl\\}"); - - /** * Builds up the Url to Alfresco based on the settings in the * {@link SysAdminParams}. @@ -152,68 +146,4 @@ 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 getWorkspaceUrl(SysAdminParams sysAdminParams) - { - return buildWorkspaceUrl( - sysAdminParams.getAlfrescoProtocol(), - sysAdminParams.getAlfrescoHost(), - sysAdminParams.getAlfrescoPort()); - } - - protected static String buildWorkspaceUrl(String workSpaceProtocol, String workspaceHost, int workspacePort) { - StringBuilder workspaceUrl = new StringBuilder(); - workspaceUrl.append(workSpaceProtocol); - workspaceUrl.append("://"); - workspaceUrl.append(workspaceHost); - if ("http".equals(workSpaceProtocol) && workspacePort == 80) - { - // Not needed - } - else if ("https".equals(workSpaceProtocol) && workspacePort == 443) - { - // Not needed - } - else - { - workspaceUrl.append(':'); - workspaceUrl.append(workspacePort); - } - - return workspaceUrl.toString(); - } - - /** - * Replaces the repo base url placeholder, namely {@literal ${repoBaseUrl}}, with workspace url. - * - * @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 replaceRepoBaseUrlPlaceholder(String value, SysAdminParams sysAdminParams) - { - if (value != null) - { - return REPOBASE_PATTERN.matcher(value).replaceAll(getWorkspaceUrl(sysAdminParams)); - } - return value; - } - - public static String replaceWorkSpaceUrlPlaceholder(String pageUrl,String workspaceUrl) - { - if (pageUrl != null) - { - return WORKSPACE_PATTERN.matcher(pageUrl).replaceAll(workspaceUrl); - } - return pageUrl; - } - } diff --git a/repository/src/main/resources/alfresco/client/config/repo-clients-apps.properties b/repository/src/main/resources/alfresco/client/config/repo-clients-apps.properties index c18c0a2298..16e27a74e1 100644 --- a/repository/src/main/resources/alfresco/client/config/repo-clients-apps.properties +++ b/repository/src/main/resources/alfresco/client/config/repo-clients-apps.properties @@ -20,15 +20,6 @@ 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=${repoBaseUrl}/workspace - -repo.client-app.workspace.templateAssetsUrl=${workspaceUrl}/images - -# reset password request email template path -repo.client-app.workspace.requestResetPasswordTemplatePath=alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl -# reset password UI page url -repo.client-app.workspace.resetPasswordPageUrl=${workspaceUrl}/reset-password/ -# reset password confirmation email template path -repo.client-app.workspace.confirmResetPasswordTemplatePath= \ No newline at end of file +repo.client-app.workspace.inviteModeratedTemplatePath= +repo.client-app.workspace.workspaceUrl=workspace +repo.client-app.workspace.templateAssetsUrl=${alfrescoUrl}/images diff --git a/repository/src/main/resources/alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl b/repository/src/main/resources/alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl deleted file mode 100644 index 170532a6ac..0000000000 --- a/repository/src/main/resources/alfresco/templates/reset-password-email-templates/forgot-password-email-template.ftl +++ /dev/null @@ -1,12 +0,0 @@ - -
-You are receiving this email because you(or someone else) requested the password reset of your account.
-Please click on the following link, or paste this url into your browser to complete the process:
- -If you received this in error, you can safely ignore it.
-Kind regards
- - \ No newline at end of file diff --git a/repository/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java b/repository/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java index 899241b449..a4b4e94c54 100644 --- a/repository/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java +++ b/repository/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java @@ -91,7 +91,6 @@ public class ResetPasswordServiceImplTest private static TestPerson testPerson; private static EmailUtil emailUtil; - private static TestPerson testPersonForWorkspace; @BeforeClass public static void initStaticData() throws Exception @@ -115,18 +114,9 @@ public class ResetPasswordServiceImplTest .setPassword("password") .setEmail(userName + "@example.com"); - String userNameForWorkspace = "shane.doe" + System.currentTimeMillis(); - testPersonForWorkspace = new TestPerson() - .setUserName(userNameForWorkspace) - .setFirstName("Shane") - .setLastName("doe") - .setPassword("password") - .setEmail(userNameForWorkspace + "@example.com"); - transactionHelper.doInTransaction((RetryingTransactionCallback