Should fix passwords with chars

This commit is contained in:
Tracker-Friendly 2023-11-16 07:47:17 +00:00
parent 22441e4388
commit 5672d0de41
6 changed files with 8 additions and 4 deletions

10
app.py
View File

@ -11,10 +11,14 @@ def is_valid_input(input_string):
app = Flask(__name__)
def create_email_account(username, password):
if is_valid_input(password) and is_valid_input(username):
if password and is_valid_input(username):
try:
with open("password.tmp", "w") as file:
file.write(password)
# Use echo to securely pass the password to the command
cmd = ["echo", password, "|", "doas", "-u", "maddy", "maddy", "creds", "create", f"{username}@hectabit.org"]
cmd = ["cat", "password.tmp", "|", "doas", "-u", "maddy", "maddy", "creds", "create", f"{username}@hectabit.org"]
result = subprocess.run(" ".join(cmd), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
cmd2 = ["doas", "-u", "maddy", "maddy", "imap-acct", "create", f"{username}@hectabit.org"]
@ -45,7 +49,7 @@ def register():
username = request.form.get('username')
password = request.form.get('password')
if not is_valid_input(password) or not is_valid_input(username):
if not is_valid_input(username):
return render_template('num.html'), 400
if create_email_account(username, password):

0
public/cta/index.html Normal file → Executable file
View File

0
public/cta/political.mov Normal file → Executable file
View File

0
public/index.html Normal file → Executable file
View File

0
public/static/css/main.css Normal file → Executable file
View File

View File

@ -11,7 +11,7 @@
</div>
<div class="content">
<h1>Error!</h1>
<p1>You can only have Alphanumerical characters and periods in your username / password.</p1>
<p1>You can only have Alphanumerical characters and periods in your username!</p1>
<div class=spacer2>
<button onclick="history.back()">Go Back</button>
</div>