Hello Everyone,
You must be thinking then what is left now?
So yes. i am here with some more technical details of AccountManagemntService API in AEM.
In the Felix console,there are three configurations related to “cq.account” in AEM.
Component com.adobe.cq.account.api.AccountManagementService
Fig - com.adobe.cq.account.api.AccountManagementService |
Detailed explanation:
- Validity period of the manager token: The value of this property shows that the token for reset password or account-confirmation mail has validity of 600 seconds.You can change the value of it as per the requirement.
- Node Name : The “requestnewaccount” is a node in crx having the values of email format to request for a new account .So if there is any customization in email format,you can create a new node and change its properties value.
Fig - requestnewaccount node in crx |
- Node Name: The “requestnewpwd” is having all the values in the email format for request for a new password mail.
Fig - requestnewpwd node in crx |
Component com.adobe.cq.account.impl.AccountManagementServlet
Fig - com.adobe.cq.account.impl.AccountManagementServlet |
Detailed explanation:
- Node Name: The “informnewaccount” is having all the values in the email format to confirm the user about creation of the account.
- Node Name: The “informnewpwd” is having all the values in the email format to confirm the user about changing the password successfully.
Points to remember:
- All the nodes specified above are under a specific path “/etc/security/accountmgr/jcr:content”. If any of the node name or properties need to be changed, all modifications need to be done under this path only, ,because this path is hard-coded in “AccountManagementService” API in AEM.
- The sling:resourceType (cq/security/components/accountmanager/mail) should remain same for the new node.
com.day.cq.security.impl.account.CqAccountManagerFactory.name
Fig - com.day.cq.security.impl.account.CqAccountManagerFactory.name |
This configuration was in use when AccountManager API used to work.But in AEM 6.2 ,it has been deprecated. So this configuration is no longer in use from AEM 6.2 onward.
Example: Let’s take an example of changing the format of request for a new account Mail. So i am creating a new node named “requestaccount” and update this name in configuration Manager of Felix console.
Fig - requestaccount node in crx |
When i register a new user, a mail is sent with a new format.
Fig - new mail format |
So how it is done!!
Things to remember while using AccountManagementService API in AEM
- The requestAccount() method has two steps internally
- Create a user in AEM in disabled mode.
- Send an email to the user for account confirmation.
This method returns true only when these two steps are successfully performed.Sometimes there is a problem in sending mail and it returns false.
- In the same way resetPassword() method also internally execute two steps:
- Reset Password in the AEM instance.
- Send a confirmation mail to the user.
This method returns true only if these two steps are executed successfully.
Note: It is important to note that the correct email Configurations are important to deal with this API.
Here is the git repo:
Note:Don’t forget to remove “POST” from filter methods from “Adobe Granite CSRF filter” as we are making a lot of POST requests in this project so need to allow these.
|
If you have any query or suggestion then kindly comment or mail us at sgaem.blog02@gmail.com
Hope it will help you guys !!
Thanks and Happy Learning .
No comments:
Post a Comment