-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
in theory, it's done, but i didn't fully test it yet
- Loading branch information
Showing
10 changed files
with
341 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,65 @@ | ||
<script src="Index.js" type="text/javascript" charset="utf-8"></script> | ||
<!DOCTYPE html> | ||
<html lang="en" > | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>Login</title> | ||
<link rel="stylesheet" href="./css/login.css"> | ||
|
||
</head> | ||
<body> | ||
<!-- partial:index.partial.html --> | ||
<!-- Responsive Desktop/Mobile Login form considered to be used as mobile first approach--> | ||
<!-- Wave animation credit: https://codepen.io/goodkatz --> | ||
|
||
<div class="header"> | ||
|
||
<!--Content before waves--> | ||
<div class="inner-header flex"> | ||
<!--Just the logo.. Don't mind this--> | ||
|
||
<h3>Login</h3> | ||
</div> | ||
|
||
<!--Waves Container--> | ||
<div> | ||
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" | ||
viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"> | ||
<defs> | ||
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" /> | ||
</defs> | ||
<g class="parallax"> | ||
<use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(255,255,255,0.7" /> | ||
<use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(255,255,255,0.5)" /> | ||
<use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(255,255,255,0.3)" /> | ||
<use xlink:href="#gentle-wave" x="48" y="7" fill="#fff" /> | ||
</g> | ||
</svg> | ||
</div> | ||
<!--Waves end--> | ||
|
||
</div> | ||
<!--Header ends--> | ||
|
||
<!--Content starts--> | ||
|
||
<div id="login" style="text-align: center; padding:10px"></div> | ||
|
||
<div class="content flex"> | ||
<form> | ||
<input id="logMail" type="text" placeholder="Email" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Email'"/> | ||
<input id="logPass" type="password" placeholder="Password" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Password'"/> | ||
</form> | ||
<button id="log" class="login-btn">Login</button> | ||
<div class="bottom-container"> | ||
<p>Not registered with us?</p><a href="sign.html">Sign Up!</a> | ||
<div> | ||
|
||
<!--Content ends--> | ||
<!-- partial --> | ||
<script type="text/javascript" src="dependencias\jquery.min.js"></script> | ||
<script type="text/javascript" src="javascript\const.js"></script> | ||
<script type="text/javascript" src="javascript\login.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const socket = `ws://127.0.0.1:4000` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var conn = new WebSocket(socket); | ||
|
||
// Attach an error listener to the WebSocket object | ||
conn.addEventListener('error', function(event) { | ||
console.log('WebSocket error:', event); | ||
console.log("error occours in conection"); | ||
window.alert("There was an error in your conection to the server, or the devs forget to turn the server on..."); | ||
}); | ||
|
||
conn.onmessage = function(e){ | ||
|
||
let data = JSON.parse(e.data); | ||
|
||
console.log(data) | ||
|
||
if (data.ctxStatus == "success") { | ||
|
||
sessionStorage.setItem("id", data.id); | ||
sessionStorage.setItem("img", data.img); | ||
window.location.replace("home.html"); | ||
|
||
} else { | ||
|
||
document.querySelector("#login").innerHTML = "wrong e-mail or password"; | ||
} | ||
}; | ||
|
||
function login(){ | ||
|
||
var email = document.getElementById("logMail").value; | ||
var password = document.getElementById("logPass").value; | ||
|
||
if(email == "" || password == ""){ | ||
|
||
document.querySelector("#login").innerHTML = "fill all the fields"; | ||
} else { | ||
|
||
conn.send(JSON.stringify({ | ||
act:"register", | ||
ctx:"login", | ||
email: email, | ||
password: password | ||
})); | ||
|
||
//document.getElementById("login_msg").click(); | ||
//window.location.replace("home.php"); | ||
//console.log("log"); | ||
} | ||
} | ||
|
||
document.querySelector("#log").addEventListener("click", login ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var conn = new WebSocket(socket); | ||
|
||
// Attach an error listener to the WebSocket object | ||
conn.addEventListener('error', function(event) { | ||
console.log('WebSocket error:', event); | ||
console.log("error occours in conection"); | ||
window.alert("There was an error in your conection to the server, or the devs forget to turn the server on..."); | ||
}); | ||
|
||
conn.onmessage = function(e){ | ||
|
||
let data = JSON.parse(e.data); | ||
|
||
console.log(data) | ||
|
||
if (data.status = "success") { | ||
if(data.ctxStatus == "success"){ | ||
document.querySelector("#sign").innerHTML = "Account created!"; | ||
} else { | ||
document.querySelector("#sign").innerHTML ="Email already regstered"; | ||
} | ||
} | ||
}; | ||
|
||
function sign(){ | ||
|
||
var username = document.getElementById("signName").value; | ||
var email = document.getElementById("signMail").value; | ||
var password =document.getElementById("signPass").value; | ||
|
||
if(username=="" || email=="" || password==""){ | ||
document.querySelector("#sign").innerHTML = "fill all the fields"; | ||
} else { | ||
conn.send(JSON.stringify({ | ||
act:"register", | ||
ctx:"sign", | ||
email:email, | ||
username:username, | ||
password:password | ||
})); | ||
} | ||
} | ||
|
||
document.querySelector("#action").addEventListener("click", sign ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.