Skip to content

Commit

Permalink
Merge pull request #139 from docusign/fix/added-custom-error-to-examples
Browse files Browse the repository at this point in the history
Added checks for email and user name for examples 20, 22 and 23
  • Loading branch information
paigesrossi authored Jun 12, 2024
2 parents 899c7e8 + c1998ae commit cb157d2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception
@Override
protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response)
throws ApiException, IOException {
if (args.getSignerEmail().equals(config.getSignerEmail())) {
throw new ApiException(config.getCodeExamplesText().SupportingTexts.IdenticalEmailsNotAllowedErrorMessage);
}

String accountId = session.getAccountId();

ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public EG022ControllerKBAAuthentication(DSConfiguration config, Session session,
// ***DS.snippet.0.start
protected Object doWork(WorkArguments args, ModelMap model,
HttpServletResponse response) throws ApiException, IOException {
if (args.getSignerEmail().equals(config.getSignerEmail())) {
throw new ApiException(config.getCodeExamplesText().SupportingTexts.IdenticalEmailsNotAllowedErrorMessage);
}

// Step 1: Construct your API headers
EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public EG023ControllerIdvAuthentication(DSConfiguration config, Session session,

@Override
protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException {
if (args.getSignerEmail().equals(config.getSignerEmail())) {
throw new ApiException(config.getCodeExamplesText().SupportingTexts.IdenticalEmailsNotAllowedErrorMessage);
}

ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken());
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
String workflowId = IdvAuthenticationService.retrieveWorkflowId(apiClient, session.getAccountId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class SupportingTexts {

public String CFRError;

public String IdenticalEmailsNotAllowedErrorMessage;

public LoginPage LoginPage;

public SelectAPIPage SelectAPIPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
name="signerEmail"
aria-describedby="emailHelp"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputPlaceholder()}"
required
value="${locals.dsConfig.signerEmail}">
required>

<small id="emailHelp" class="form-text text-muted">
${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
Expand All @@ -79,7 +78,6 @@
id="signerName"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerNameInputNumber).getInputPlaceholder()}"
name="signerName"
value="${locals.dsConfig.signerName}"
required>
</div>
<input type="hidden" name="_csrf" value="${csrfToken}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<h4>${example.getExampleName()}</h4>
<p>${example.getExampleDescription()}</p>
<p>${example.getNotes()}</p>

<c:if test="${showDoc}">
<p><a target='_blank' href='${documentation}'>Documentation</a> about this example.</p>
Expand All @@ -32,8 +31,7 @@
name="signerEmail"
aria-describedby="emailHelp"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputPlaceholder()}"
required
value="${locals.dsConfig.signerEmail}">
required>

<small id="emailHelp" class="form-text text-muted">
${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
Expand All @@ -49,7 +47,6 @@
id="signerName"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerNameInputNumber).getInputPlaceholder()}"
name="signerName"
value="${locals.dsConfig.signerName}"
required>
</div>
<input type="hidden" name="_csrf" value="${csrfToken}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<h4>${example.getExampleName()}</h4>
<p>${example.getExampleDescription()}</p>
<p>${example.getNotes()}</p>

<c:if test="${showDoc}">
<p><a target='_blank' href='${documentation}'>Documentation</a> about this example.</p>
Expand All @@ -31,8 +30,7 @@
name="signerEmail"
aria-describedby="emailHelp"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputPlaceholder()}"
required
value="${locals.dsConfig.signerEmail}">
required>

<small id="emailHelp" class="form-text text-muted">
${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
Expand All @@ -48,7 +46,6 @@
id="signerName"
placeholder="${example.getForms().get(formNumber).getInputs().get(signerNameInputNumber).getInputPlaceholder()}"
name="signerName"
value="${locals.dsConfig.signerName}"
required>
</div>
<input type="hidden" name="_csrf" value="${csrfToken}">
Expand Down

0 comments on commit cb157d2

Please sign in to comment.