-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2192d92
commit b714d57
Showing
2 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
console.log("forgotpassword.js has loaded!!!"); | ||
|
||
function showError(input, message) { | ||
const formControl = input.parentElement; | ||
formControl.className = "form-control error"; | ||
const small = formControl.querySelector('small'); | ||
small.innerText = message | ||
} | ||
|
||
|
||
// function validateEmail(email) { | ||
// var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | ||
// return emailPattern.test(email); | ||
// } | ||
|
||
// function validateUserName(username) { | ||
|
||
// } | ||
|
||
|
||
document.getElementById("password_form").addEventListener("submit", async function (e) { | ||
e.preventDefault(); | ||
console.log("button is pressed"); | ||
|
||
const userEmailElement = document.getElementById("user_email"); | ||
const userNameElement = document.getElementById("username"); | ||
|
||
var userEmail = userEmailElement.value; | ||
var username = userNameElement.value; | ||
|
||
var isValid = true; | ||
|
||
if (userEmail == '') { | ||
var errorMessage = "Please enter an email address."; | ||
showError(userEmailElement, errorMessage); | ||
isValid = false; | ||
} | ||
|
||
if (username == '') { | ||
var errorMessage = "Please enter a username."; | ||
showError(userNameElement, errorMessage); | ||
isValid = false; | ||
} | ||
|
||
|
||
if (!isValid) { | ||
return false; | ||
} | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters