Skip to content

Commit

Permalink
Added checks for email and user name for examples 20, 22 and 23 (#153)
Browse files Browse the repository at this point in the history
* added custom error messages

* fix linter issues
  • Loading branch information
RomanBachaloSigmaSoftware authored Jun 12, 2024
1 parent 62e5a8d commit 8b096a9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
7 changes: 7 additions & 0 deletions app/eSignature/views/eg020_phone_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ def phone_authentication():

# 1. Get required arguments
args = Eg020PhoneAuthenticationController.get_args()
if args["envelope_args"]["signer_email"] == DS_CONFIG["signer_email"]:
return render_template(
"error.html",
error_code=400,
error_message=session["manifest"]["SupportingTexts"]["IdenticalEmailsNotAllowedErrorMessage"]
)

try:
# Step 2: Call the worker method for authenticating with phone
results = Eg020PhoneAuthenticationController.worker(args)
Expand Down
7 changes: 7 additions & 0 deletions app/eSignature/views/eg022_kba_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def kba_authentication():

# 1. Get required arguments
args = Eg022KBAAuthenticationController.get_args()

if args["envelope_args"]["signer_email"] == DS_CONFIG["signer_email"]:
return render_template(
"error.html",
error_code=400,
error_message=session["manifest"]["SupportingTexts"]["IdenticalEmailsNotAllowedErrorMessage"]
)
try:
# Step 2: Call the worker method for kba
results = Eg022KBAAuthenticationController.worker(args)
Expand Down
7 changes: 7 additions & 0 deletions app/eSignature/views/eg023_idv_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def idv_authentication():

# 1. Get required data
args = Eg023IDVAuthenticationController.get_args()

if args["envelope_args"]["signer_email"] == DS_CONFIG["signer_email"]:
return render_template(
"error.html",
error_code=400,
error_message=session["manifest"]["SupportingTexts"]["IdenticalEmailsNotAllowedErrorMessage"]
)
try:
# 2: Call the worker method for idv authentication
results = Eg023IDVAuthenticationController.worker(args)
Expand Down
5 changes: 2 additions & 3 deletions app/templates/eSignature/eg020_phone_authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@
<div class="form-group">
<label for="signer_email">{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputName'] }}</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required
value="{{ signer_email }}">
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required>
<small id="emailHelp" class="form-text text-muted">{{ session['manifest']['SupportingTexts']['HelpingTexts']['EmailWontBeShared'] | safe}}</small>
</div>
<div class="form-group">
<label for="signer_name">{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputName'] }}</label>
<input type="text" class="form-control" id="signer_name" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputPlaceholder'] }}" name="signer_name"
value="{{ signer_name }}" required>
required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% include 'submit_button.html' %}
Expand Down
5 changes: 2 additions & 3 deletions app/templates/eSignature/eg022_kba_authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
<div class="form-group">
<label for="signer_email">{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputName'] }}</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required
value="{{ signer_email }}">
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required>
<small id="emailHelp" class="form-text text-muted">{{ session['manifest']['SupportingTexts']['HelpingTexts']['EmailWontBeShared'] | safe}}</small>
</div>
<div class="form-group">
<label for="signer_name">{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputName'] }}</label>
<input type="text" class="form-control" id="signer_name" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputPlaceholder'] }}" name="signer_name"
value="{{ signer_name }}" required>
required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% include 'submit_button.html' %}
Expand Down
5 changes: 2 additions & 3 deletions app/templates/eSignature/eg023_idv_authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
<div class="form-group">
<label for="signer_email">{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputName'] }}</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required
value="{{ signer_email }}">
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_email_index]['InputPlaceholder'] }}" required>
<small id="emailHelp" class="form-text text-muted">{{ session['manifest']['SupportingTexts']['HelpingTexts']['EmailWontBeShared'] | safe}}</small>
</div>
<div class="form-group">
<label for="signer_name">{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputName'] }}</label>
<input type="text" class="form-control" id="signer_name" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputPlaceholder'] }}" name="signer_name"
value="{{ signer_name }}" required>
required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% include 'submit_button.html' %}
Expand Down

0 comments on commit 8b096a9

Please sign in to comment.