starting users

This commit is contained in:
2025-05-18 05:41:26 +03:00
parent 03a20128f7
commit ac51e5c0e8
12 changed files with 314 additions and 2 deletions

10
views/base.etlua Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Porom</title>
</head>
<body>
<% content_for("inner") %>
</body>
</html>

12
views/user/login.etlua Normal file
View File

@ -0,0 +1,12 @@
<h1>Log In</h1>
<% if err then %>
<h2><%= err %></h2>
<% end %>
<form method="post" action="<%= url_for('user_login') %>" enctype="multipart/form-data">
<label for="username">Username</label><br>
<input type="text" id="username" name="username" required autocomplete="username"><br>
<label for="password">Password</label><br>
<input type="password" id="password" name="password" required autocomplete="current-password"><br>
<input type="submit" value="Log in">
</form>

15
views/user/signup.etlua Normal file
View File

@ -0,0 +1,15 @@
<h1>Sign up</h1>
<% if err then %>
<h2><%= err %></h2>
<% end %>
<form method="post" action="<%= url_for('user_signup') %>" enctype="multipart/form-data">
<label for="username">Username</label><br>
<input type="text" id="username" name="username" pattern="[\w\-]{3,20}" title="3-20 characters. Only upper and lowercase letters, hyphens, and underscores" required autocomplete="username"><br>
<label for="password">Password</label><br>
<input type="password" id="password" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" required autocomplete="new-password"><br>
<label for="password2">Confirm Password</label><br>
<input type="password" id="password2" name="password2" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" required autocomplete="new-password"><br>
<input type="submit" value="Sign up">
</form>
<p>After you sign up, an administrator will need to confirm your account before you will be allowed to post.</p>

7
views/user/user.etlua Normal file
View File

@ -0,0 +1,7 @@
<% if just_logged_in then %>
<h1>Logged in successfully.</h1>
<% end %>
<h1><%= user.username %></h1>
<% if user:is_guest() then %>
<h2>You are a guest. An administrator needs to approve your account before you will be able to post.</h2>
<% end %>