Chapter 9: initial express-auth samples

This commit is contained in:
Beth Griggs
2020-09-03 00:57:10 +01:00
parent 4316d1a2ca
commit a6dd85cad5
7 changed files with 651 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
<html>
<head>
<title> <%= title %> </title>
</head>
<body>
<h1> <%= title %> </h1>
<p> Welcome to <%= title %> </p>
<% if (user) { %>
<p> Hello <%= user.name %>! </p>
<p> <a href=/auth/logout> Logout </a> </p>
<% } else { %>
<p> <a href=/auth/login> Login </a> </p>
<% } %>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
<html>
<head>
<title>Express - Login</title>
</head>
<body>
<h1>Login</h1>
<% if (fail) { %>
<h2>Login Failed.</h2>
<% } %>
<form method="post" action="login">
Username: <input name="username" />
Password: <input type="password" name="password" />
<input type="submit" value="Login" />
</form>
</body>
</html>