Class FormEmailVerificationProcessor
java.lang.Object
sk.iway.iwcm.components.multistep_form.support.FormEmailVerificationProcessor
- All Implemented Interfaces:
FormProcessorInterface
@Component
public class FormEmailVerificationProcessor
extends Object
implements FormProcessorInterface
Processor that handles email verification for multi-step forms.
Responsibilities:
- After step 1, generates a verification code and sends it to the user's email.
- During step 2, validates the code provided by the user and manages attempt limits.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleFormSave(String formName, FormSettingsEntity formSettings, Integer iLastDocId, javax.servlet.http.HttpServletRequest request) Performs custom final save logic for the form.voidrunStepInterceptor(String formName, FormStepEntity stepEntity, org.json.JSONObject stepData, javax.servlet.http.HttpServletRequest request, Map<String, String> errors) Executes an optional interceptor after a step is submitted, for example sending a verification code to email or SMS.voidvalidateStep(String formName, FormStepEntity stepEntity, org.json.JSONObject stepData, javax.servlet.http.HttpServletRequest request, Map<String, String> errors) Validates user-submitted data for a specific step of a multistep form.
-
Field Details
-
SESSION_VERIFY_CODE_KEY
- See Also:
-
SESSION_VERIFY_CODE_ATTEMPTS_KEY
- See Also:
-
-
Constructor Details
-
FormEmailVerificationProcessor
public FormEmailVerificationProcessor()
-
-
Method Details
-
runStepInterceptor
public void runStepInterceptor(String formName, FormStepEntity stepEntity, org.json.JSONObject stepData, javax.servlet.http.HttpServletRequest request, Map<String, String> errors) throws SaveFormExceptionDescription copied from interface:FormProcessorInterfaceExecutes an optional interceptor after a step is submitted, for example sending a verification code to email or SMS.- Specified by:
runStepInterceptorin interfaceFormProcessorInterface- Parameters:
formName- logical identifier of the formstepData- JSON payload containing the step fields and valuesrequest- current HTTP request for context and additional dataerrors- mutable map to collect error messages produced by the interceptor- Throws:
SaveFormException- to abort the flow when the interceptor detects blocking issues
-
validateStep
public void validateStep(String formName, FormStepEntity stepEntity, org.json.JSONObject stepData, javax.servlet.http.HttpServletRequest request, Map<String, String> errors) throws SaveFormExceptionDescription copied from interface:FormProcessorInterfaceValidates user-submitted data for a specific step of a multistep form.- Specified by:
validateStepin interfaceFormProcessorInterface- Parameters:
formName- logical identifier of the formstepData- JSON payload containing the step fields and valuesrequest- current HTTP request for context and additional dataerrors- mutable map to collect field or general error messages (key → message)- Throws:
SaveFormException- when validation fails in a way that should stop processing
-
handleFormSave
public boolean handleFormSave(String formName, FormSettingsEntity formSettings, Integer iLastDocId, javax.servlet.http.HttpServletRequest request) throws SaveFormException, IOException Description copied from interface:FormProcessorInterfacePerforms custom final save logic for the form. The return value controls whether the default WebJET save mechanism is executed.- Specified by:
handleFormSavein interfaceFormProcessorInterface- Parameters:
formName- logical identifier of the formformSettings- configuration of the form used during savingiLastDocId- last document ID (if any) associated with the submissionrequest- current HTTP request for context and additional data- Returns:
trueto continue with the default WebJET save;falseto skip it- Throws:
SaveFormException- for functional errors during saveIOException- for I/O related problems that occur during save
-