diff --git a/login.css b/login.css new file mode 100644 index 0000000..b779a43 --- /dev/null +++ b/login.css @@ -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; +} \ No newline at end of file diff --git a/login.html b/login.html new file mode 100644 index 0000000..93b42d0 --- /dev/null +++ b/login.html @@ -0,0 +1,31 @@ + + + + + + Login + + +
+ +
+
+

+

 

+

 

+

Login

+   +   +

+

+ +

+

+ +

+

+   +

+
+ + \ No newline at end of file diff --git a/login.jpg b/login.jpg new file mode 100644 index 0000000..1105d63 Binary files /dev/null and b/login.jpg differ diff --git a/login.js b/login.js new file mode 100644 index 0000000..14477b7 --- /dev/null +++ b/login.js @@ -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=" "; + document.getElementById('NotYou').innerHTML=" "; + 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=" "; + // If its not the username + document.getElementById('NotYou').innerHTML='   Not '+id+' ?'; + flag=1; + return; + } + } + if(flag==2){ + alert("Too Many Tries Reload The Page"); + } +function notyou() +{ + location.reload(); +} + \ No newline at end of file diff --git a/success.html b/success.html new file mode 100644 index 0000000..d4fa8bb --- /dev/null +++ b/success.html @@ -0,0 +1,15 @@ + + + + + Success + + +
+ +
+
+

Login Successful !!!

+
+ + \ No newline at end of file