Skip to content

Commit

Permalink
Merge pull request #904 from sarahannie/signup
Browse files Browse the repository at this point in the history
adjusted the email signup validation error
  • Loading branch information
birm authored Apr 1, 2024
2 parents fd45197 + 3fcce46 commit 9522fe7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
15 changes: 4 additions & 11 deletions apps/signup/signup.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* signup.css */


body {
color: #999;
background: #f5f5f5;
Expand Down Expand Up @@ -121,14 +118,10 @@ nav li:not(.active):hover a{
color: black;
cursor: pointer;
}
#info{
color: black;
}
#sub{
font-weight:bold;
font-size: 14pt;
background-color: #17a2b8;

.error-message {
color: red;
font-size: 0.8em;
}

@media screen and (max-width:736px) {
Expand All @@ -138,6 +131,6 @@ nav li:not(.active):hover a{
}
@media screen and (max-width: 480px) {
.signup-form {
width: 300px;
width: 300px;
}
}
7 changes: 4 additions & 3 deletions apps/signup/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ <h2 style="margin-top: -.5em;">User Signup</h2>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope" style="margin-top: 0.5em;"></i></span>
<input id="mail" type="email" class="form-control" name="email" placeholder="Email" required="required">
<input id="mail" type="email" class="form-control" name="email" placeholder="Email" >
</div>
<div id="emailerror" class="error-message"></div>
</div>
<br>
<div class="form-group">
Expand Down Expand Up @@ -132,5 +133,5 @@ <h2 style="margin-top: -.5em;">User Signup</h2>
<!-- script to call a footer(layout footer in the common > utils folder) function -->
<script> insertFooterLayout();</script>

</body>
</html>
 </body>
</html>
9 changes: 6 additions & 3 deletions apps/signup/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ function addUser(){
// var attr = document.querySelector('input[name="attr"]:checked').value
var attrEle = document.getElementById("attr");
var attr = attrEle.options[attrEle.selectedIndex].value;
var emailErr = document.getElementById('emailerror');

if (!(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email))) {
window.alert("Please enter a valid email");
return;
if (email === '') {
emailErr.textContent = 'Please enter your email';
} else if (!(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email))) {
emailErr.textContent = 'Please enter a valid email';
}


var userType = "Null"
if (attr == "3"){
userType = "Admin"
Expand Down

0 comments on commit 9522fe7

Please sign in to comment.