mirror of
https://github.com/xfarrow/blink
synced 2025-03-27 13:10:05 +01:00
update
This commit is contained in:
parent
55c2d889e8
commit
2e97d41697
@ -1,35 +1,61 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" >
|
<html lang="en" >
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>HTML5 Login Form with validation Example</title>
|
<title>HTML5 Login Form with validation Example</title>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
|
<link rel="stylesheet" href="../css/login-register.css">
|
||||||
<link rel="stylesheet" href="../css/login-register.css">
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- partial:index.partial.html -->
|
||||||
|
<div id="login-form-wrap">
|
||||||
|
<h2>Login</h2>
|
||||||
|
<form id="login-form" method="POST">
|
||||||
|
|
||||||
</head>
|
<p>
|
||||||
<body>
|
<input type="email" id="email" name="email" placeholder="Email Address" required><i class="validation"><span></span><span></span></i>
|
||||||
<!-- partial:index.partial.html -->
|
</p>
|
||||||
<div id="login-form-wrap">
|
|
||||||
<h2>Login</h2>
|
|
||||||
<form id="login-form" method="POST">
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="email" id="email" name="email" placeholder="Email Address" required><i class="validation"><span></span><span></span></i>
|
<input type="password" id="password" name="password" placeholder="Password" required><i class="validation"><span></span><span></span></i>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="password" id="password" name="password" placeholder="Password" required><i class="validation"><span></span><span></span></i>
|
<button type="button" onclick="login()">Login</button>
|
||||||
</p>
|
</p>
|
||||||
|
</form>
|
||||||
|
<div id="create-account-wrap">
|
||||||
|
<p>Not a member? <a href="./register.html">Create Account</a><p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<script>
|
||||||
<input type="submit" id="login" value="Login">
|
function login() {
|
||||||
</p>
|
const email = document.getElementById("email").value;
|
||||||
</form>
|
const password = document.getElementById("password").value;
|
||||||
<div id="create-account-wrap">
|
|
||||||
<p>Not a member? <a href="./register.html">Create Account</a><p>
|
if(!email || !password){
|
||||||
</div><!--create-account-wrap-->
|
return;
|
||||||
</div><!--login-form-wrap-->
|
}
|
||||||
<!-- partial -->
|
|
||||||
|
const options = {
|
||||||
</body>
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ email, password }),
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('http://localhost:3000/blinkapi/login', options)
|
||||||
|
.then(response => {})
|
||||||
|
.then(data => {
|
||||||
|
document.cookie = `token=${data.token};`;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
alert("An error has occurred :-( please try again later")
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -59,11 +59,11 @@
|
|||||||
alert("Congratulations! You've successfully registered to Blink." +
|
alert("Congratulations! You've successfully registered to Blink." +
|
||||||
" Please click on the e-mail we sent you to confirm your account");
|
" Please click on the e-mail we sent you to confirm your account");
|
||||||
|
|
||||||
window.location.href = '/login.html';
|
window.location.href = '/login.html';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
alert("An error has occured :-( please try again later")
|
alert("An error has occurred :-( please try again later")
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user