forked from cs4241-19a/fp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththis.html
More file actions
150 lines (132 loc) · 5.24 KB
/
Copy paththis.html
File metadata and controls
150 lines (132 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-light shadow fixed-top">
<div class="container">
<a class="navbar-brand" href="#">MtG Deck Builder</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<div>
<button id = "login-button" class = "button">Login</button>
<button id = "signup-button" class = "button">Signup</button>
<button id = "signout-button" class = "button">Signout</button>
</div>
</li>
<!-- <li class="nav-item">
<a class="nav-link" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li> -->
</ul>
</div>
</div>
</nav>
<!-- Full Page Image Header with Vertically Centered Content -->
<header class="masthead">
<div class="container h-100">
<div class="row h-100 align-items-center">
<div class="col-12 text-center">
<h1 class="font-weight-light">Vertically Centered Masthead Content</h1>
<p class="lead">A great starter layout for a landing page</p>
</div>
</div>
</div>
</header>
<!-- Page Content -->
<section class="py-5">
<div class="container">
<h2 class="font-weight-light">Page Content</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus ab nulla dolorum autem nisi officiis blanditiis voluptatem hic, assumenda aspernatur facere ipsam nemo ratione cumque magnam enim fugiat reprehenderit expedita.</p>
</div>
</section>
<!-- ------------------------------------------ -->
<div class="container-fluid">
<div class="row no-gutter">
<div class="d-none d-md-flex col-md-4 col-lg-6 bg-image"></div>
<div class="col-md-8 col-lg-6">
<div class="login d-flex align-items-center py-5">
<div class="container">
<div class="row">
<div class="col-md-9 col-lg-8 mx-auto">
<h3 class="login-heading mb-4">Welcome back!</h3>
<form>
<div class="form-label-group">
<input type="username" id="username" class="form-control" placeholder="Username" required autofocus>
<label for="inputUsername">Username</label>
</div>
<div class="form-label-group">
<input type="password" id="password" class="form-control" placeholder="Password" required>
<label for="inputPassword">Password</label>
</div>
<button class="btn btn-lg btn-primary btn-block btn-login text-uppercase font-weight-bold mb-2" id="confirmLogin" type="submit">Sign in</button>
<button class="btn btn-lg btn-primary btn-block btn-login text-uppercase font-weight-bold mb-2" id="signUp">Sign Up</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
const redirectHome = function () {
fetch('/', {
method: 'GET',
credentials: 'include',
}).then(function (response) {
window.location.href = response.url
})
}
const redirectLogin = function () {
fetch('/redirect-login', {
method: 'GET',
credentials: 'include',
}).then(function (response) {
window.location.href = response.url
})
}
const redirectSignup = function () {
fetch('/redirect-signup', {
method: 'GET',
credentials: 'include',
}).then(function (response) {
window.location.href = response.url
})
}
const login = function () {
const username = document.querySelector('#username'),
password = document.querySelector('#password'),
json = {
'username': username.value,
'password': password.value,
},
body = JSON.stringify(json)
username.value = ""
password.value = ""
fetch('/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body
})
.then(function (response) {
// do something with the reponse
window.location.href = response.url
})
return false
}
//const homeButton = document.getElementById('home-button');
const signupButton = document.getElementById('signup-button');
const confirmLoginButton = document.getElementById('confirmLogin);
//homeButton.onclick = redirectHome;
signupButton.onclick = redirectSignup;
confirmLoginButton.onclick = login;
</script>