Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signup page:Improved the error handling #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/js/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ var signupBlock = document.getElementById("signedup");
var BASE_URL = "https://api.susi.ai";
var passwordlim = document.getElementById("passwordlim");
var password = document.getElementById("password");
var cpassword = document.getElementById("cpassword");
var emailLim=document.getElementById("emailLim")
var email=document.getElementById("email")

var cpasswordlim=document.getElementById("cpasswordlim")
window.onload = () => {
showsignupBlock(true);
};
Expand All @@ -21,23 +25,39 @@ let showsignupBlock = (show) => {
}
};



password.addEventListener("keyup", ()=>{
if(password.value.length<6 || password.value.length>64){
passwordlim.removeAttribute("hidden");
document.getElementById("signupbutton").setAttribute("disabled", "true");
} else {
passwordlim.setAttribute("hidden", "true");
//document.getElementById("signupbutton").removeAttribute("disabled");
}
});


cpassword.addEventListener("keyup", ()=>{
if(password.value!==cpassword.value || cpassword.value.length<6 || cpassword.value.length>64){
cpasswordlim.removeAttribute("hidden");
cpasswordlim.innerHTML="Either Password not match Or Password length between 6 to 64"
document.getElementById("signupbutton").setAttribute("disabled", "true");
}else{
cpasswordlim.setAttribute("hidden", "true");
document.getElementById("signupbutton").removeAttribute("disabled");
}
});


signupForm.addEventListener("submit", (event) => {
event.preventDefault();
var email=document.getElementById("email").value;
if(!email){
alert("Email field cannot be empty");
return;
}
//alert("Enter the proper email")
emailLim.removeAttribute("hidden");
return;
}
var password=document.getElementById("password").value;
if(!password){
alert("Password field cannot be empty");
Expand Down
16 changes: 13 additions & 3 deletions src/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<html>
<head>
<title>SUSI Login Portal</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/signup.css">
</head>
Expand All @@ -16,8 +18,11 @@
<div id="notsignup">
<form id="signupForm">
<div class="form-group">
<label for="email">Email address:</label>
<label for="email">Email Address:</label>
<input type="email" class="form-control" id="email" placeholder="Email">
<div style="text-align: center">
<small hidden id="emailLim" style="color: #fff;"> Please enter the email</small>
</div>
</div>
<br />
<div class="form-group">
Expand All @@ -31,13 +36,18 @@
<div class="form-group">
<label for="password">Confirm Password:</label>
<input type="password" class="form-control" id="cpassword" placeholder="Confirm Password">
<div style="text-align: center">
<small hidden id="cpasswordlim" style="color: #fff;">Password doesnot match</small>
</div>
</div>
<br>
<button disabled type="submit" class="btn btn-success" id="signupbutton">Signup</button>
<br>
<p style="text-align: center;">
<a href="login.html" style="color: #fff; ">Already Registered? Want to Login</a>
</p>
<a href="login.html" style="color: #fff; ">Already Registered? Want to Login</a><br>
<!-- <a href=""style="color: #fff;"> <i class="fa fa-google-plus"></i> Signup via Google </a><br>
<a href=""style="color: #fff;"> <i class="fa fa-facebook"></i> Signup via facebook </a><br>
--> </p>
</form>
</div>
<div id="signedup">
Expand Down