Update register.html

This commit is contained in:
xfarrow 2023-10-18 15:02:34 +02:00
parent 37aa4268b4
commit 0cb7adef30

View File

@ -2,7 +2,7 @@
<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>Sign Up to Blink</title>
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> --> <!-- <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">
<script src=""></script> <script src=""></script>
@ -35,6 +35,7 @@
</div> </div>
<script> <script>
function register(){ function register(){
const display_name = document.getElementById("displayname").value; const display_name = document.getElementById("displayname").value;
const email = document.getElementById("email").value; const email = document.getElementById("email").value;
@ -51,16 +52,16 @@
}, },
body: JSON.stringify({ display_name, email, password }), body: JSON.stringify({ display_name, email, password }),
}; };
alert(JSON.stringify({ display_name, email, password }));
fetch('http://localhost:3000/blinkapi/register', options) fetch('http://localhost:3000/blinkapi/register', options)
.then(response => { .then(response => {
if (response.ok) { if (response.ok) {
alert('You successfully registered an account') alert("Congratulations! You've successfully registered to Blink. Please click on the e-mail we sent you to confirm your account");
// Redirect to a different page on the same domain using a relative path
window.location.href = '/newpage.html';
} }
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
alert("An error has occurred. Try again later");
}); });
} }
</script> </script>