forked from ChandelAnish/fusionFLOW
-
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.
create a simple sign-in page which link the signup page and vice versa
- Loading branch information
1 parent
e6bf02f
commit 4b8bf66
Showing
2 changed files
with
152 additions
and
140 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,139 +1,142 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Sign Up to fusionFLOW</title> | ||
<link rel="icon" href="../assets/fusionFLOW-logo.png"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
</head> | ||
</head> | ||
<body class="bg-body-tertiary"> | ||
<div class="d-flex align-items-center py-4" style="height: 100vh;"> | ||
<main | ||
class="form-signin m-auto rounded-4" | ||
style="width: 25rem; background-color: white; padding: 25px;" | ||
> | ||
<form id="signupForm"> | ||
<h1 class="h3 mb-3 fw-normal">Sign Up to fusionFLOW</h1> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="text" | ||
class="form-control" | ||
id="username" | ||
placeholder="name_123" | ||
name="username" | ||
/> | ||
<label for="username">Username</label> | ||
</div> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="email" | ||
class="form-control" | ||
id="email" | ||
placeholder="[email protected]" | ||
name="email" | ||
/> | ||
<label for="email">Email address</label> | ||
</div> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="password" | ||
placeholder="Password" | ||
name="password" | ||
/> | ||
<label for="password">Password</label> | ||
</div> | ||
|
||
<div class="form-floating"> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="confirmPassword" | ||
placeholder="Password" | ||
name="confirmPassword" | ||
/> | ||
<label for="confirmPassword">Confirm Password</label> | ||
</div> | ||
|
||
<!-- warning message --> | ||
<div | ||
class="text-danger m-2" | ||
id="warningMsg" | ||
style="height: 24px; text-align: center;" | ||
></div> | ||
|
||
<div class="form-check text-start my-3"> | ||
<input | ||
class="form-check-input" | ||
type="checkbox" | ||
value="remember-me" | ||
id="flexCheckDefault" | ||
/> | ||
<label class="form-check-label" for="flexCheckDefault"> | ||
Remember me | ||
</label> | ||
</div> | ||
|
||
<button class="btn btn-primary py-2" type="submit" style="width: 10rem;"> | ||
Sign up | ||
</button> | ||
</form> | ||
</main> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('signupForm').addEventListener('submit', async function (e) { | ||
e.preventDefault(); | ||
const warningMsg = document.getElementById('warningMsg'); | ||
warningMsg.textContent = ''; | ||
|
||
const form = e.target; | ||
|
||
const username = form.username.value; | ||
const email = form.email.value; | ||
const password = form.password.value; | ||
const confirmPassword = form.confirmPassword.value; | ||
|
||
if (password !== confirmPassword) { | ||
warningMsg.textContent = 'Passwords do not match'; | ||
return; | ||
} | ||
|
||
const userDetails = { username, email, password, confirmPassword }; | ||
|
||
const response = await signup(userDetails); | ||
|
||
if (response.signup) { | ||
window.location.href = 'https://fusionflow-signin.onrender.com'; | ||
} else { | ||
warningMsg.textContent = response.msg; | ||
} | ||
}); | ||
|
||
async function signup(userDetails) { | ||
try { | ||
const response = await fetch('https://fusionflow-vm59.onrender.com/signup', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
body: JSON.stringify(userDetails), | ||
}); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
</script> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> | ||
</body> | ||
</html> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Sign Up to fusionFLOW</title> | ||
<link rel="icon" href="../assets/fusionFLOW-logo.png"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
</head> | ||
</head> | ||
<body class="bg-body-tertiary"> | ||
<div class="d-flex align-items-center py-4" style="height: 100vh;"> | ||
<main | ||
class="form-signin m-auto rounded-4" | ||
style="width: 25rem; background-color: white; padding: 25px;" | ||
> | ||
<form id="signupForm"> | ||
<h1 class="h3 mb-3 fw-normal">Sign Up to fusionFLOW</h1> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="text" | ||
class="form-control" | ||
id="username" | ||
placeholder="name_123" | ||
name="username" | ||
/> | ||
<label for="username">Username</label> | ||
</div> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="email" | ||
class="form-control" | ||
id="email" | ||
placeholder="[email protected]" | ||
name="email" | ||
/> | ||
<label for="email">Email address</label> | ||
</div> | ||
|
||
<div class="form-floating mb-2"> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="password" | ||
placeholder="Password" | ||
name="password" | ||
/> | ||
<label for="password">Password</label> | ||
</div> | ||
|
||
<div class="form-floating"> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="confirmPassword" | ||
placeholder="Password" | ||
name="confirmPassword" | ||
/> | ||
<label for="confirmPassword">Confirm Password</label> | ||
</div> | ||
|
||
<!-- warning message --> | ||
<div | ||
class="text-danger m-2" | ||
id="warningMsg" | ||
style="height: 24px; text-align: center;" | ||
></div> | ||
|
||
<div class="form-check text-start my-3"> | ||
<input | ||
class="form-check-input" | ||
type="checkbox" | ||
value="remember-me" | ||
id="flexCheckDefault" | ||
/> | ||
<label class="form-check-label" for="flexCheckDefault"> | ||
Remember me | ||
</label> | ||
</div> | ||
|
||
<button class="btn btn-primary py-2" type="submit" style="width: 10rem;"> | ||
Sign up | ||
</button> | ||
|
||
<a href="index.html">Already have an account? Log in here</a> | ||
|
||
</form> | ||
</main> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('signupForm').addEventListener('submit', async function (e) { | ||
e.preventDefault(); | ||
const warningMsg = document.getElementById('warningMsg'); | ||
warningMsg.textContent = ''; | ||
|
||
const form = e.target; | ||
|
||
const username = form.username.value; | ||
const email = form.email.value; | ||
const password = form.password.value; | ||
const confirmPassword = form.confirmPassword.value; | ||
|
||
if (password !== confirmPassword) { | ||
warningMsg.textContent = 'Passwords do not match'; | ||
return; | ||
} | ||
|
||
const userDetails = { username, email, password, confirmPassword }; | ||
|
||
const response = await signup(userDetails); | ||
|
||
if (response.signup) { | ||
window.location.href = 'https://fusionflow-signin.onrender.com'; | ||
} else { | ||
warningMsg.textContent = response.msg; | ||
} | ||
}); | ||
|
||
async function signup(userDetails) { | ||
try { | ||
const response = await fetch('https://fusionflow-vm59.onrender.com/signup', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
body: JSON.stringify(userDetails), | ||
}); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
</script> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |