Should fix passwords with chars
This commit is contained in:
parent
22441e4388
commit
5672d0de41
10
app.py
10
app.py
|
@ -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):
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue