Skip to content

Commit 05818b8

Browse files
committed
imported head.html to signup.html to get the signup.js run proprely
1 parent 689ebdb commit 05818b8

File tree

2 files changed

+75
-66
lines changed

2 files changed

+75
-66
lines changed

src/auth/signup/index.html

Lines changed: 72 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,76 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<title>Sign Up to the Fairfield Programming Association</title>
5-
<include src="./includes/head.html"></include>
6-
<link rel="stylesheet" href="../style.css" />
7-
</head>
83

9-
<body class="text-center">
10-
<main class="form-signin">
11-
<form id="signup-form">
12-
<a href="/">
13-
<img class="mb-4" alt="" width="240" src="/resources/logo.svg" />
14-
</a>
15-
<h1 class="h3 mb-3 fw-normal">Signup Below</h1>
4+
<head>
5+
<title>Sign Up to the Fairfield Programming Association</title>
6+
<!-- <include src="./includes/head.html"></include> -->
7+
<!-- Meta Tags -->
8+
<meta charset="UTF-8" />
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1611

17-
<div class="form-floating">
18-
<input
19-
type="text"
20-
name="username"
21-
id="username"
22-
class="form-control"
23-
placeholder="Username"
24-
/>
25-
<label for="username">Username</label>
26-
</div>
27-
<div class="form-floating">
28-
<input
29-
type="email"
30-
name="email"
31-
class="form-control"
32-
id="email"
33-
placeholder="name@example.com"
34-
/>
35-
<label for="email">Email address</label>
36-
</div>
37-
<div class="form-floating">
38-
<input
39-
type="password"
40-
name="password"
41-
class="form-control"
42-
id="password"
43-
placeholder="Password"
44-
/>
45-
<label for="password">Password</label>
46-
</div>
47-
<div
48-
id="warningBox"
49-
style="display: none"
50-
class="alert alert-primary"
51-
role="alert"
52-
></div>
53-
<button class="w-100 btn btn-lg btn-primary" type="submit">
54-
Signup
55-
</button>
56-
<a class="w-100 text-muted p-4" href="/auth/login" type="submit">
57-
Go to Login
58-
</a>
59-
<p class="mt-5 mb-3 text-muted">© 2021-2022</p>
60-
</form>
61-
</main>
62-
<script src="./signup.js"></script>
63-
</body>
64-
</html>
12+
<!-- Cookies Library -->
13+
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
14+
15+
<!-- Global site tag (gtag.js) - Google Analytics -->
16+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LMPD3GLWYH"></script>
17+
<script>
18+
window.dataLayer = window.dataLayer || [];
19+
20+
function gtag() {
21+
dataLayer.push(arguments);
22+
}
23+
gtag("js", new Date());
24+
25+
gtag("config", "G-LMPD3GLWYH");
26+
</script>
27+
28+
<!-- Bootstrap -->
29+
<link rel="stylesheet" href="/src/bootstrap.sass" />
30+
31+
<!-- Bootstrap Icons -->
32+
<!-- <link
33+
rel="stylesheet"
34+
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css"
35+
/> -->
36+
37+
<!-- Favicon -->
38+
<link rel="shortcut icon" href="/resources/favicon.svg" />
39+
40+
<link rel="stylesheet" href="../style.css" />
41+
</head>
42+
43+
<body class="text-center">
44+
<main class="form-signin">
45+
<form id="signup-form">
46+
<a href="/">
47+
<img class="mb-4" alt="" width="240" src="/resources/logo.svg" />
48+
</a>
49+
<h1 class="h3 mb-3 fw-normal">Signup Below</h1>
50+
51+
<div class="form-floating">
52+
<input type="text" name="username" id="username" class="form-control" placeholder="Username" />
53+
<label for="username">Username</label>
54+
</div>
55+
<div class="form-floating">
56+
<input type="email" name="email" class="form-control" id="email" placeholder="name@example.com" />
57+
<label for="email">Email address</label>
58+
</div>
59+
<div class="form-floating">
60+
<input type="password" name="password" class="form-control" id="password" placeholder="Password" />
61+
<label for="password">Password</label>
62+
</div>
63+
<div id="warningBox" style="display: none" class="alert alert-primary" role="alert"></div>
64+
<button class="w-100 btn btn-lg btn-primary" type="submit">
65+
Signup
66+
</button>
67+
<a class="w-100 text-muted p-4" href="/auth/login" type="submit">
68+
Go to Login
69+
</a>
70+
<p class="mt-5 mb-3 text-muted">© 2021-2022</p>
71+
</form>
72+
</main>
73+
<script src="./signup.js"></script>
74+
</body>
75+
76+
</html>

src/auth/signup/signup.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@ signupForm.onsubmit = () => {
2222
});
2323

2424
fetch(request).then(async (response) => {
25-
2625
if (response.status == 200) {
2726
// get the data
2827
const data = await response.json();
2928

30-
data.json().then((jsonData) => {
3129

32-
Cookies.set('token', jsonData.token);
33-
alert("Email has been sent to you, Please view it to validate your email address. ( The email will expire in 4 days )")
34-
window.location.href = "/dashboard";
30+
Cookies.set('token', data.token);
31+
alert("Email has been sent to you, Please view it to validate your email address. ( The email will expire in 4 days )")
32+
window.location.href = "/dashboard";
3533

36-
})
3734

3835
} else if (response.status == 403) {
3936

0 commit comments

Comments
 (0)