teqnology / alfresco-login-reset-share

Alfresco Share new materialize login page and an Activiti reset password workflow feature
GNU General Public License v3.0
2 stars 9 forks source link

Alfresco Custom Login - Share

Features

This process will allow a more solid and secure approach to reset password requests. It replicates the current Alfresco Cloud behaviour. The main improvement over other Alfresco reset password extensions is that no plain text passwords are sent through emails. The user will be able to change it's own password as long as the activiti$id, the unique key ID and the email/username match. The Share login page will also call the Alfresco /api/server web script and allow users to see if the repository is available, instead of trying to login and being prompted with an annoying message.

Essentials

Quickstart

Quickstart for devs

alfresco-login-reset-repo

For additional info please refer to Maven Alfresco SDK documentation - Repository AMP Archetype.

alfresco-login-reset-share

For additional info please refer to Maven Alfresco SDK documentation - Share AMP Archetype.

(optional) working without alfresco-login-reset-repo

Often on local dev env there is no SMTP configuration. In order to test the project properly (the send email action will throw an error otherwise) you might want to configure the alfresco-login-reset-share project to connect to a working remote repository. In case you want to make changes to the share-tier project only, you can update the share config file alfresco-login-reset-share/src/main/resources/META-INF/share-config-custom.xml. Just locate the config evaluator="string-compare" condition="Remote"> section and update it's <endpoint-url> values accordingly.

Source code documentation

Alfresco Explorer Web Script family /androgogic

forgot-password-workflow

This web script is triggered when the user requests a reset password through the forgot-password Share page. It checks on input provided, and sends an email (if any users is found) with a different message if the provided email is associated with one or multiple users. The web script will then create a new workflow generating a unique key ID and a unique activiti$id. The email will contain a link to update the password, along with the previously generated unique key ID and the activiti$id. The link will be available for a one time use only. If not used, the link will expire in 24 hours automatically through a scheduled action.

reset-password-workflow

list-users-workflow

ACP bootstrap

The HTML5 email templates are stored in the acp file inside the /src/main/amp/config/alfresco/bootstrap folder. There are two ACPs to be deployed:

Scheduled Action

The bean id endResetPasswordWorkflow declared in /src/main/amp/config/alfresco/alfresco-login-reset-scheduled-action-services-context.xml will be triggered every 10 minutes to check and close/end:

Alfresco Custom Theme

The theme files are located in:

Share Login Theme

The login is no longer managed by the theme customization files. The Share pages are built through Surf platform Freemarker templates and JavaScript APIs. If you want to update the login and reset password pages style you might want to look into the files stored in these paths:

Alfresco Share custom login extension

This is a completely new page, based on materializecss project (currently Alpha 0.96.1), with a login.js controller. The controller calls a public web script:

function getServer() {
    var srv = remote.call("/api/server")
    if (srv.status == 200) {
      srvObj = eval("(" + srv + ")");
      model.srv = srvObj;
    }
}

and injects model.srv data into the html login page.

This allows the Share login page to prompt users with a message if the Alfresco repository is down or unreachable.

In order to override the default login page, share-config-custom.xml needs to be updated as follows:

<alfresco-config>
   <config evaluator="string-compare" condition="WebFramework">
      <web-framework>
         <defaults>
            <page-type>
               <id>login</id>
               <page-instance-id>login</page-instance-id>
            </page-type>
         </defaults>
      </web-framework>
   </config>
</alfresco-config>

Credits

Written with StackEdit.