diff --git a/daemon.py b/daemon.py index d8e633b97..b47c983a2 100644 --- a/daemon.py +++ b/daemon.py @@ -210,6 +210,7 @@ from shares import expireShares from categories import setHashtagCategory from languages import getActorLanguages from languages import setActorLanguages +from utils import removeLineEndings from utils import getBaseContentFromPost from utils import acctDir from utils import getImageExtensionFromMimeType @@ -4237,6 +4238,10 @@ class PubServer(BaseHTTPRequestHandler): # change password if fields.get('password') and \ fields.get('passwordconfirm'): + fields['password'] = \ + removeLineEndings(fields['password']) + fields['passwordconfirm'] = \ + removeLineEndings(fields['passwordconfirm']) if len(fields['password']) > 2 and \ fields['password'] == fields['passwordconfirm']: # set password diff --git a/utils.py b/utils.py index 2ac643404..c8fd8fb77 100644 --- a/utils.py +++ b/utils.py @@ -2606,3 +2606,11 @@ def validUrlPrefix(url: str) -> bool: if url.startswith(pre): return True return False + + +def removeLineEndings(text: str) -> str: + """Removes any newline from the end of a string + """ + text = text.replace('\n', '') + text = text.replace('\r', '') + return text.strip()