Updated login

This commit is contained in:
Tracker-Friendly 2023-11-19 23:47:22 +00:00
parent b30e8deae9
commit 596dabfc47
12 changed files with 40 additions and 20 deletions

View File

@ -10,9 +10,11 @@ Copy config.ini.example to config.ini and edit accordingly
Use your web server to host everything in public, and run app.py with python.
Reverse-proxy signup/signup.py to /register, and run as an a normal user with doas permissions for maddy
Reverse-proxy signup/signup.py to /register
Reverse-proxy login/login.py to /login, and run as the maddy user to have r/w access to the db
Reverse-proxy account/account.py to /account
Run both scripts as a user with access to the Maddy DB and CLI tools
## Dependencies

View File

@ -8,18 +8,15 @@ from waitress import serve
config = configparser.ConfigParser()
config.read("../config.ini")
secretkey = config.get("Login", "secretkey")
database = config.get("Login", "database")
runport = config.get("Login", "port")
database = config.get("Account", "database")
runport = config.get("Account", "port")
# Status report
print("HectaMail Login Service is starting up...")
print("Your secret key is:", secretkey)
print("HectaMail Account Service is starting up...")
print("Your database is located at:", database)
app = Flask(__name__)
app.secret_key = secretkey
def fetch_hash_from_database(key):
conn = sqlite3.connect(database)

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>HectaMail</title>
<link rel="stylesheet" href="/static/css/main.css" media="">
</head>
<body>
<div class="headerbar">
<a href="https://mail.hectabit.org/">HectaMail</a>
<a href="https://mail.hectabit.org/register">Sign up</a>
<a class="main" href="https://mail.hectabit.org/account">Account</a>
</div>
<div class="content">
<h1>Are you SURE you would like to delete your account?</h1>
<button onclick="location.href = '/account/dashboard';">Whoops, wrong button, bring me back to the safe zone!</button>
<form method="POST" action="/account/deleteacct">
<input type="hidden" name="unique_token" value="{{ password_hash }}">
<input type="submit" style="background-color: rgb(20, 10, 30);padding: 0;text-decoration: underline;font-family: Arial;" value="Yes, I understand this is permanent and cannot be undone!">
</div>
<style type="text/css"></style>
</body></html>

View File

@ -8,12 +8,12 @@
<div class="headerbar">
<a href="https://mail.hectabit.org/">HectaMail</a>
<a href="https://mail.hectabit.org/register">Sign up</a>
<a class="main" href="https://mail.hectabit.org/login">Account</a>
<a class="main" href="https://mail.hectabit.org/account">Account</a>
</div>
<div class="content">
<h1>Account management</h1>
<button onclick="location.href = '/login/changepass';">Change Password</button>
<button onclick="location.href = '/login/deleteacct';">Delete Account</button>
<button onclick="location.href = '/account/changepass';">Change Password</button>
<button onclick="location.href = '/account/deleteacct';">Delete Account</button>
</div>
<style type="text/css"></style>
</body></html>

View File

@ -8,12 +8,12 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a href="/register">Sign up</a>
<a class="main" href="/login">Login</a>
<a class="main" href="/account">Account</a>
</div>
<div class="content">
<h1>Login to your Email Account</h1>
<p1>Warning! This is only a proof of concept and has no actual use!</p1>
<form method="POST" action="/login/api">
<form method="POST" action="/account/api">
<label for="username">Email</label>
<div class="spacer">
<input type="text" name="email" required="">

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a class="main" href="/">HectaMail</a>
<a href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Welcome to HectaMail!</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Error!</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Error!</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Error!</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Register an Email Account</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/accounts">Account</a>
</div>
<div class="content">
<h1>Error!</h1>

View File

@ -8,7 +8,7 @@
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
<a href="/login">Login</a>
<a href="/account">Account</a>
</div>
<div class="content">
<h1>Done!</h1>