Presenting a Password Confirmation Form in vCO / vRO

Requirement:

Present a vCO / vRO form which contains two password entry fields using SecureStrings and a field which displays whether the two entered passwords match.

Using an if statement to test whether two SecureStrings are equal will fail even if the text entered is identical. As mentioned in this communities post, in a workflow it is possible to take the SecureStrings into a scriptable task and output them as Strings. However, in the presentation of the workflow this method is not possible.

Solution:

Create an action which converts a SecureString to a String. Call that action from another action that is used to display whether the two entered passwords match. Here are the details of how I did it.

Create an action secureStringToString

[code language=“javascript”]

outputText = text;

return outputText

[/code]

 

Create an action testPasswords

 

[code language=“javascript”]

var passwordTest1 = System.getModule(“com.jm-test”).secureStringToString(password1); var passwordTest2 = System.getModule(“com.jm-test”).secureStringToString(password2);

if (passwordTest1 == passwordTest2){

return “Matching Passwords” } else {

return “Non-Matching Passwords” }

[/code]

Create a workflow with the following inputs:

Set the presentation for the first three inputs to be mandatory and the displayConfirmation input to use the testPasswords action:

username mandatory

displayConfirmation Data binding

displayConfirmation Data binding testPasswords action

Run the workflow and observe the text changes in displayConfirmation dependent on the passwords matching:

 

I’d be interested to hear if anyone has a better way to do this because I reckon there might be one :-)