Compare commits
3
Commits
ef9cc1aab3
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
701da16aaf
|
||
|
|
57de8f47d0
|
||
|
|
671af52b15
|
@@ -62,7 +62,13 @@ def check_user(user):
|
|||||||
|
|
||||||
def get_messagefile(user):
|
def get_messagefile(user):
|
||||||
"""Return message file of user, and create if necessary"""
|
"""Return message file of user, and create if necessary"""
|
||||||
filepath = f"message-{user}.txt"
|
# Path of the project
|
||||||
|
gitpath = str(Path(app.root_path).parent)
|
||||||
|
# File name of the message
|
||||||
|
filename = f"message-{user}.txt"
|
||||||
|
# Combine path
|
||||||
|
filepath = os.path.join(gitpath, filename)
|
||||||
|
|
||||||
if not os.path.isfile(filepath):
|
if not os.path.isfile(filepath):
|
||||||
Path(filepath).touch()
|
Path(filepath).touch()
|
||||||
|
|
||||||
@@ -97,6 +103,9 @@ def get_filterfile(user):
|
|||||||
with open(filepath, "w", encoding="utf-8") as filterfile:
|
with open(filepath, "w", encoding="utf-8") as filterfile:
|
||||||
filterfile.write(filterconfig)
|
filterfile.write(filterconfig)
|
||||||
|
|
||||||
|
# Change permissions to 0600
|
||||||
|
os.chmod(filepath, 0o600)
|
||||||
|
|
||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
|
|
||||||
@@ -168,7 +177,6 @@ def user_update(user):
|
|||||||
with fileinput.FileInput(
|
with fileinput.FileInput(
|
||||||
get_qmailfile(user),
|
get_qmailfile(user),
|
||||||
inplace=True,
|
inplace=True,
|
||||||
backup=".bak",
|
|
||||||
) as qmailfile:
|
) as qmailfile:
|
||||||
for line in qmailfile:
|
for line in qmailfile:
|
||||||
print(
|
print(
|
||||||
|
|||||||
Reference in New Issue
Block a user