First commit

This commit is contained in:
AndrewTrieu
2023-04-21 13:17:50 +03:00
commit c9f31e5c8a
26 changed files with 465 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<% layout("./layouts/layout.eta") %>
<h1>Online Forum</h1>
<h2>Welcome!</h2>
<p>You are authenticated, welcome <%= it.username %>!</p>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://unpkg.com/papercss@1.8.2/dist/paper.min.css">
<title>Online Forum</title>
</head>
<body>
<% if (it.user) { %>
<nav class="border fixed split-nav">
<div class="nav-brand">
<h3>Hello <%= it.user.username %>!</h3>
</div>
<div class="collapsible">
<input id="collapsible1" type="checkbox" name="collapsible1">
<label for="collapsible1">
<div class="bar1"></div>
<div class="bar2"></div>
</label>
<div class="collapsible-body">
<ul class="inline">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<% } %>
<div class="paper container">
<%~ it.body %>
</div>
</body>
</html>

View File

@@ -0,0 +1,24 @@
<% layout("./layouts/layout.eta") %>
<h1>Login</h1>
<form method="POST" action="/auth/login">
Username:<br/>
<input type="text" name="username" /><br/>
Password:<br/>
<input type="password" name="password" /><br/>
<input type="submit" value="Login" />
</form>
<% if (it.errors) { %>
<ul>
<% Object.keys(it.errors).forEach((error) => { %>
<% Object.values(it.errors[error]).forEach((err) => { %>
<li><%= err %></li>
<% }); %>
<% }); %>
</ul>
<% } %>
<br/>
<a href="/auth/register">Are you a new user?</a>

View File

@@ -0,0 +1,9 @@
<% layout("./layouts/layout.eta") %>
<h1>Online Forum</h1>
<p>This is an online forum that allows the participants to join, post questions, answer the posts etc.</p>
<p>Are you already registered? <a href="/auth/login">Login</a></p>
<p>Not registered yet? <a href="/auth/register">Register</a></p>

View File

@@ -0,0 +1,24 @@
<% layout("./layouts/layout.eta") %>
<h1>New user registration</h1>
<form method="POST" action="/auth/register">
Username:<br/>
<input type="text" name="username" /><br/>
Password:<br/>
<input type="password" name="password" /><br/>
<input type="submit" value="Register" />
</form>
<% if (it.errors) { %>
<ul>
<% Object.keys(it.errors).forEach((error) => { %>
<% Object.values(it.errors[error]).forEach((err) => { %>
<li><%= err %></li>
<% }); %>
<% }); %>
</ul>
<% } %>
<br/>
<a href="/auth/login">Are you already registered?</a>