-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathhtml.js
More file actions
30 lines (27 loc) · 695 Bytes
/
html.js
File metadata and controls
30 lines (27 loc) · 695 Bytes
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
'use strict'
function loginPage () {
return '<html>' +
'<head><title>Login</title></head>' +
'<body>' +
'<h1>Login</h1>' +
'<form action="http://localhost:3000/login" method="post">' +
'<h2>Email</h2>' +
'<input type="email" name="email">' +
'<h2>Password</h2>' +
'<input type="password" name="password">' +
'<br><br><button type="submit">Login</button>' +
'</form>' +
'</body>' +
'</html>'
}
function defaultPage (isAuthenticated) {
if (isAuthenticated) {
return 'logged in<br><br><a href="/logout">Logout</a>'
} else {
return 'please login<br><br><a href="/login">Login</a>'
}
}
module.exports = {
loginPage,
defaultPage
}