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
53 changes: 53 additions & 0 deletions login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.back{
position: absolute;
z-index: -1;
}
.myButton {
background-color:#2e98e8;;
border: transparent;
color: #ffffff;
font-family:Arial;
font-size:15px;
padding:3px 20px;
width: 150px;
height: 30px;
}
.small{
color: dodgerblue;
font-family: Avant Garde,Avantgarde,Century Gothic,CenturyGothic,AppleGothic,sans-serif;
font-size: 13px;
}
.oops{
color: red;
font-family: Avant Garde,Avantgarde,Century Gothic,CenturyGothic,AppleGothic,sans-serif;
font-size: 13px;
}
.pb{
position:relative;overflow:hidden
}
.logn{
font-family: Papyrus,fantasy;
font-size: 50px;
font-weight: 100%;
}
.gren {
color: green;
font-family: Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;
font-size: 50px;
line-height: 160px;
font-weight: normal;
margin-bottom: 0px;
margin-top: 40px; t
ext-align: center;
text-shadow: 0 1px 1px #fff;
}
.large{
font-size: 70px;
}
.txt {
font-size: 15px;
padding: 10px;
opacity: 0.6;
border: none;
border-bottom: solid 2px #2e98e8;
}
31 changes: 31 additions & 0 deletions login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="login.css">
<script type="text/javascript"src="login.js"> </script>
<head>
<title>Login</title>
</head>
<body>
<div style='position:absolute;z-index:-1;left:0;top:0;width:100%;height:100%'>
<img src='login.jpg' style='width:100%;height:100%'/>
</div>
<center>
<p>
<p>&nbsp</p>
<p>&nbsp</p>
<p><font size="34" class="logn" color="black">Login</font></p>
<a id="Name">&nbsp</a>
<a id="oops" class="oops">&nbsp</a>
</p>
<p>
<input type="textbox" class="txt" style="width: 300px; height:20px;" onKeyDown="if(event.keyCode==13) login()" placeholder="Enter ID" id="txt1" />
</p>
<p>
<input type="button" value="NEXT" onclick="login()" class="myButton" id="logi" />
</p>
<p>
<a onClick="notyou();" class="small" style="cursor: pointer; cursor: hand;" id="NotYou">&nbsp</a>
</p>
</center>
</body>
</html>
Binary file added login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var flag=0;
var trial=0;
var id,pass;
function login()
{
if(flag==1){
//checking password
if(document.getElementById('txt1').value=='')
{
return;
}
pass=document.getElementById('txt1').value;
var xmlReq=new XMLHttpRequest();
xmlReq.open("POST","http://moodshare.herokuapp.com/login",true);
xmlReq.setRequestHeader('Access-Control-Allow-Origin','*');
xmlReq.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlReq.send("username="+id+"&password="+pass);
xmlReq.onreadystatechange = function(){
if(xmlReq.readyState == 4 && xmlReq.status == 202){
window.open("success.html","_self");
return;
}
else if(xmlReq.readyState == 4 && xmlReq.status == 401){
trial++;
document.getElementById('txt1').type='text';
document.getElementById('txt1').placeholder='Enter ID';
document.getElementById('txt1').value='';
document.getElementById('logi').value="NEXT";
document.getElementById('Name').innerHTML="&nbsp";
document.getElementById('NotYou').innerHTML="&nbsp";
flag=0;
document.getElementById('oops').innerHTML="Oops, Username Or Password Was Wrong!";
if(trial==3)
{
//lock if tried more than 3 times
document.getElementById('txt1').disabled=true;
document.getElementById('logi').value="Too Many Tries";
document.getElementById('oops').innerHTML="Too Many Tries, Reload The Page";
flag=2;
return;
}

return;
}
};

}
if(flag==0)
{
//Entering id or username
if(document.getElementById('txt1').value==''){
return;
}
id=document.getElementById('txt1').value;
document.getElementById('logi').value="Sign in";
document.getElementById('Name').innerHTML='Welcome '+id;
document.getElementById('txt1').value='';
document.getElementById('txt1').type='password';
document.getElementById('txt1').placeholder='Password';
document.getElementById('oops').innerHTML="&nbsp";
// If its not the username
document.getElementById('NotYou').innerHTML=' &nbsp Not '+id+' ?';
flag=1;
return;
}
}
if(flag==2){
alert("Too Many Tries Reload The Page");
}
function notyou()
{
location.reload();
}

15 changes: 15 additions & 0 deletions success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="login.css">
<head>
<title>Success</title>
</head>
<body>
<div style='position:absolute;z-index:-1;left:0;top:0;width:100%;height:100%'>
<img src='login.jpg' style='width:100%;height:100%' />
</div>
<center>
<p class="gren"> Login Successful !!!</p>
</center>
</body>
</html>