Skip to content
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
57 changes: 57 additions & 0 deletions demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
body{
background-image: url("http://www.designbolts.com/wp-content/uploads/2012/11/Free-Simple-Black-Seamless-Pattern-for-Website-Background.jpg");
margin: 20px;
padding: 10px;

}
h1{
color: white;
font-family: comic sans ms;
text-align: center;
font-size: 40px;
margin-bottom: 30px;
}
p{
font-size: 18px;
font-family: comic sans ms;
margin: 10px;
padding: 10px;
text-align: center;
color: white;
}
#username{
font-size: 15px;
font-family: times new roman;
padding: 5px;
margin: 10px;
text-align: center;
border: 2px,solid,white;
border-radius: 5px;

}
#password{
font-size: 15px;
font-family: times new roman;
padding: 5px;
margin: 10px;
text-align: center;
border: 2px,solid,white;
border-radius: 5px;
}
#btn{
font-family: comic sans ms;
font-size: px;
border-radius: 5px;
width: 205px;
margin: 25px;
padding: 5px;
background-color: #ccc;
}

.t{
font-size: 20px;
font-weight: bold;
color: white;
font-family: comic sans ms;
margin: 2px;
}
30 changes: 30 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="demo.css">

</head>
<body>
<h1>Project Lumos!</h1>
<br/>
<center>
<div class="t">
Username : <input type="text" id="username" placeholder="username"> </input>
</div>
<br/>
<div class="t">
Password : <input type="password" id="password" placeholder="password"> </input>
</div>
<br/>
<div class="t">
<input type="button" onclick="login()" id="btn" value="Login!!" ></input>
</div>

<p >Do not have an account? <a href="#" target="_blank">sign up</a></p>
<div id='theD' class="t" style="color: green"><br/></div>
</center>

<script type="text/javascript" src="./login.js"></script>

</body>
</html>
56 changes: 56 additions & 0 deletions login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject(){
var xmlHttp;

if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}else{
xmlHttp = new ActiveXObject("microsoft.XMLHTTP");
}

return xmlHttp;
}


function login(){
var username=document.getElementById('username').value;
var password=document.getElementById('password').value;
var senddata="username="+username+"&password="+password;
username.value='';
password.value='';

if(xmlHttp){
try{
xmlHttp.open("POST","Http://moodshare.herokuapp.com/login",true);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Access-Control-Allow-Origin","*");
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(senddata);
}catch(e){
alert( e.toString() );
}
}

}


function handleServerResponse(){
theD = document.getElementById('theD');
if(xmlHttp.readyState==4){
if(xmlHttp.status==202){
try{
text=xmlHttp.responseText;
theD.innerHTML+=text

}catch(e){
alert(e.toString());
}
}else{
alert(xmlHttp.statusText);
}
}
}

username.focus();