Skip to content

Commit

Permalink
Some basic error messages - more to be added
Browse files Browse the repository at this point in the history
  • Loading branch information
Melpip committed May 28, 2016
1 parent 59dbacd commit 3f3d738
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
6 changes: 6 additions & 0 deletions web/css/filelist.css
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ body > div:last-of-type {
display: inline;
}

#error {
background-color: #ff6666;
font-size: 14pt;
text-align:center;
}

@media screen and (max-width: 767px) {
#editoptions > select {
width: 100%;
Expand Down
3 changes: 2 additions & 1 deletion web/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<div class="container">
<div class="jumbotron">
<h1>Browser Transfer</h1>
<form action="login" method="post" id="loginform">
<div id="error"></div>
<form action="login" method="post" id="loginform" name="loginpart" onSubmit="return validateForm()">
<div class="form-group">
<label for="remote">SFTP Server Address:</label>
<input type="text" name="remote" id="remote" value="remote.labs.eait.uq.edu.au" class="form-control"/><br>
Expand Down
36 changes: 35 additions & 1 deletion web/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,38 @@ common.buildUrl = function(base, params){

common.logoutTimeout = function(){
window.location = common.buildUrl('./logout', {'flash': 'Error: SFTP Connection Timeout'});
};
};

function validateForm () {
document.getElementById("error").style.display = "none";
//store the data
var a=document.forms["loginpart"]["username"].value;
var b=document.forms["loginpart"]["password"].value;
var message=document.getElementById("error");

//If the input is null display error
if (a==null || a=="")
{
document.getElementById("error").innerHTML = "Error: You must enter a username";
document.getElementById("error").style.display = "block";
return false;
}
if (a.length!=8)
{
document.getElementById("error").innerHTML = "Error: Username must be 8 characters";
document.getElementById("error").style.display = "block";
return false;
}

if (b==null || b=="")
{
document.getElementById("error").innerHTML = "Error: You must enter a password";
document.getElementById("error").style.display = "block";
return false;
}





}

0 comments on commit 3f3d738

Please sign in to comment.