Skip to content

Commit 0012543

Browse files
authored
Merge pull request #153 from docusign/fix/added-custom-error-to-examples
Added checks for email and user name for examples 20, 22 and 23
2 parents 160b54e + 0bb8710 commit 0012543

File tree

6 files changed

+42
-13
lines changed

6 files changed

+42
-13
lines changed

src/Controllers/Examples/eSignature/EG020PhoneAuthentication.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ public function createController(): void
3535
$this->checkDsToken();
3636

3737
try {
38+
if ($this->args['envelope_args']['signer_email'] == $GLOBALS['DS_CONFIG']['signer_email']) {
39+
$GLOBALS['twig']->display(
40+
'error.html',
41+
[
42+
'error_code' => "400",
43+
'error_message' => ManifestService::getCommonTexts()['IdenticalEmailsNotAllowedErrorMessage'],
44+
'common_texts' => ManifestService::getCommonTexts()
45+
]
46+
);
47+
48+
exit;
49+
}
50+
3851
$envelopeAuthentification = PhoneAuthenticationService::phoneAuthentication(
3952
$this->args,
4053
$this::DEMO_DOCS_PATH,

src/Controllers/Examples/eSignature/EG022KbAuthentication.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ public function createController(): void
3737
# Obtain your OAuth Token
3838
$this->checkDsToken();
3939

40+
if ($this->args['envelope_args']['signer_email'] == $GLOBALS['DS_CONFIG']['signer_email']) {
41+
$GLOBALS['twig']->display(
42+
'error.html',
43+
[
44+
'error_code' => "400",
45+
'error_message' => ManifestService::getCommonTexts()['IdenticalEmailsNotAllowedErrorMessage'],
46+
'common_texts' => ManifestService::getCommonTexts()
47+
]
48+
);
49+
50+
exit;
51+
}
52+
4053
$envelopeAuthentification = KbAuthenticationService::kbAuthentification(
4154
$this->args,
4255
$this->clientService,

src/Controllers/Examples/eSignature/EG023IDVAuthentication.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ public function createController(): void
3939
$this->checkDsToken();
4040

4141
try {
42+
if ($this->args['envelope_args']['signer_email'] == $GLOBALS['DS_CONFIG']['signer_email']) {
43+
$GLOBALS['twig']->display(
44+
'error.html',
45+
[
46+
'error_code' => "400",
47+
'error_message' => ManifestService::getCommonTexts()['IdenticalEmailsNotAllowedErrorMessage'],
48+
'common_texts' => ManifestService::getCommonTexts()
49+
]
50+
);
51+
52+
exit;
53+
}
54+
4255
$envelopeAuthentification = IDVAuthenticationService::idvAuthentication(
4356
$this->args,
4457
$this->clientService,

templates/esignature/eg020_phone_authentication.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
7676
name="signer_email"
7777
aria-describedby="emailHelp"
7878
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerEmailInputNumber]['InputPlaceholder']}}"
79-
required
80-
value="{{ signer_email }}">
79+
required>
8180

8281
<small id="emailHelp" class="form-text text-muted">
8382
{{ common_texts["HelpingTexts"]["EmailWontBeShared"] | raw }}
@@ -93,7 +92,6 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
9392
id="signer_name"
9493
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerNameInputNumber]['InputPlaceholder']}}"
9594
name="signer_name"
96-
value="{{ signer_name }}"
9795
required>
9896
</div>
9997
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>

templates/esignature/eg022_kba_authentication.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
88

99
<p>{{ code_example_text["ExampleDescription"] | raw }}</p>
1010

11-
<p>{{ code_example_text["Notes"] | raw }}</p>
12-
1311
{% if show_doc %}
1412
<p><a target='_blank' href='{{ documentation | raw }}'>Documentation</a> about this example.</p>
1513
{% endif %}
@@ -50,8 +48,7 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
5048
name="signer_email"
5149
aria-describedby="emailHelp"
5250
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerEmailInputNumber]['InputPlaceholder']}}"
53-
required
54-
value="{{ signer_email }}">
51+
required>
5552

5653
<small id="emailHelp" class="form-text text-muted">
5754
{{ common_texts["HelpingTexts"]["EmailWontBeShared"] | raw }}
@@ -67,7 +64,6 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
6764
id="signer_name"
6865
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerNameInputNumber]['InputPlaceholder']}}"
6966
name="signer_name"
70-
value="{{ signer_name }}"
7167
required>
7268
</div>
7369
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>

templates/esignature/eg023_idv_authentication.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
88

99
<p>{{ code_example_text["ExampleDescription"] | raw }}</p>
1010

11-
<p>{{ code_example_text["Notes"] | raw }}</p>
12-
1311
{% if show_doc %}
1412
<p><a target='_blank' href='{{ documentation | raw }}'>Documentation</a> about this example.</p>
1513
{% endif %}
@@ -50,8 +48,7 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
5048
name="signer_email"
5149
aria-describedby="emailHelp"
5250
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerEmailInputNumber]['InputPlaceholder']}}"
53-
required
54-
value="{{ signer_email }}">
51+
required>
5552

5653
<small id="emailHelp" class="form-text text-muted">
5754
{{ common_texts["HelpingTexts"]["EmailWontBeShared"] | raw }}
@@ -67,7 +64,6 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
6764
id="signer_name"
6865
placeholder="{{code_example_text['Forms'][formNumber]['Inputs'][signerNameInputNumber]['InputPlaceholder']}}"
6966
name="signer_name"
70-
value="{{ signer_name }}"
7167
required>
7268
</div>
7369
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>

0 commit comments

Comments
 (0)