Skip to content

Commit

Permalink
Merge pull request #100 from nitinraj-tarento/patch-2
Browse files Browse the repository at this point in the history
blank field validation for username updated
  • Loading branch information
Haritest authored Jun 15, 2023
2 parents 55f4402 + 2411df4 commit 9e21947
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansible/artifacts/sunbird/login/login.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
function validateEmailChar() {
document.getElementById("login").disabled = false
const validRegex = "/^[a-z0-9_-]+(?:\.[a-z0-9_-]+)*@((?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?){2,}\.){1,3}(?:\w){2,}$/"
let userEmail = document.getElementById("username").value
let userEmail = document.getElementById("username").value.trim()
if (userEmail && userEmail.length > 0) {
if(userEmail.length > 5 && !userEmail.match(validRegex)) {
document.getElementById("emailLengthErr").innerHTML = "email is not valid"
Expand All @@ -314,7 +314,7 @@
}
}
}
else if (userEmail.length == 0) {
else if (userEmail.replace(/\s+/g, '').length == 0 || userEmail === "") {
document.getElementById("emailLengthErr").innerHTML = "email field can not be blank"
document.getElementById("login").disabled = true
}
Expand Down

0 comments on commit 9e21947

Please sign in to comment.