mirror of https://gitlab.com/bashrc2/epicyon
Ensure that line endings are removed from changed password
parent
882774bc50
commit
1544e526c4
|
@ -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
|
||||
|
|
8
utils.py
8
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()
|
||||
|
|
Loading…
Reference in New Issue