Custom submit action for adaptive form with error response

Avatar

Avatar

jetate

Avatar

jetate

jetate

14-05-2018

I'm trying to build a password reset form for logged in users to my site. I've set this up with an adaptive form, added rules for validation with new and confirm fields that must match and meet our defined password guidelines. Using Adobe Experience Manager Help | Posting Adobe Experience Manager Form Data to Custom Services I've created a custom submit action that calls my service and will update the user's password if the current password is correct.

Unfortunately, if the current password is incorrect, the form still takes the user to the confirmation page. I've been able to modify my service to return a message, but I'm not sure how to handle this in the custom submit action to return it to the user or prevent the thank you message or page from loading.

I've read through articles on using AJAX to call a custom servlet to process a form, but all of the tutorials are building these forms in JSP, not using the adaptive forms. I haven't found anything that seems to directly address AJAX with an adaptive form in enough detail to tell me where I'd put the AJAX call. Would this go in the custom submit action JSP file or a separate JS file that's pulled in with the form's Client Library Category field? I saw a reference somewhere to putting an AJAX call into the rules editor, but that didn't seem to be the smartest move to me.

I'm sorry if this seems like a silly question. I don't have a Java background, and I've only been working with AEM for about a month.

Thanks for any help.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

DarrenBiz

Avatar

DarrenBiz

DarrenBiz

30-07-2018

Just thinking outside the box here, you could set up an OSGi workflow launcher that is triggered by a rep:password property change on a user account. When the user account password is changed, it should trigger and you can run a workflow model that sends a templated email to the user. The payload of the workflow should be the node that was changed so should contain email address, name, etc for you to apply to the email template.

Answers (3)

Answers (3)

Avatar

Avatar

jetate

Avatar

jetate

jetate

31-07-2018

We wound up running into other issues with the password change once we went live. There's an issue with User Sync in 6.3 where when you set it up, you lose all of your ACLs for the home directory. We're waiting for a patch for that to be pushed out through AEM to work on it further. We don't have email enabled at the moment anyway.

I was going to use the OSGi bundle where the password is reset to send the email as part of that process, though.

Avatar

Avatar

Jared_Langdon

Avatar

Jared_Langdon

Jared_Langdon

30-07-2018

Did you make progress on this?  I'm interested to learn how you solved the problem. 

Avatar

Avatar

jetate

Avatar

jetate

jetate

15-05-2018

I've gotten this working as desired using an AJAX call in the rules editor. I've even have it set up to call guidebridge.submit() to complete the form processing when the password has been successfully updated so that the Thank You page specified is loaded.

But how can I get it to send an email to my user? If I have a custom submit action set to send an email, that never gets triggered, and I'm sure now how I can set that up in my servlet. Any help appreciated.