Skip to content

Commit

Permalink
Adding security question data for new user on sprout.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyDeSantiago committed Sep 24, 2023
1 parent 39feacb commit d32987c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/new_user_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h2 id = "avatar_form">
</select>

<div class="form-control">
<label for="question1">Enter Answer</label>
<!--<label for="question2">Enter Answer</label>-->
<input type="text" name="question1" id="question1" class="new_user_form_field" placeholder="Enter Answer">
<small>Error Message</small>
</div>
Expand All @@ -103,7 +103,7 @@ <h2 id = "avatar_form">
</select>

<div class="form-control">
<label for="question2">Enter Answer</label>
<!--<label for="question2">Enter Answer</label>-->
<input type="text" name="question2" id="question2" class="new_user_form_field" placeholder="Enter Answer">
<small>Error Message</small>
</div>
Expand Down
14 changes: 14 additions & 0 deletions public/sprout.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ document.getElementById("new_user_form").addEventListener("submit", async functi
const dateOfBirthElement = document.getElementById("dateofbirth");
const addressElement = document.getElementById("address");
const passwordElement = document.getElementById("password");
const question1Element = document.getElementById("question1");
const question2Element = document.getElementById("question2");

var userEmail = userEmailElement.value;
var firstName = firstNameElement.value;
var lastName = lastNameElement.value;
var address = addressElement.value;
var dateOfBirth = dateOfBirthElement.value;
var password = passwordElement.value;
var question1 = question1Element.value;
var question2 = question2Element.value;

var isValid = true;

Expand Down Expand Up @@ -159,6 +163,16 @@ document.getElementById("new_user_form").addEventListener("submit", async functi
isValid = false;
}

if (question1 == '') {
var errorMessage = 'Please enter an answer.';
showError(question1Element, errorMessage);
}

if (question2 == '') {
var errorMessage = 'Please enter an answer';
showError(question2Element, errorMessage);
}


if (!isValid) {
return false;
Expand Down

0 comments on commit d32987c

Please sign in to comment.