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 categories import setHashtagCategory
|
||||||
from languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from languages import setActorLanguages
|
from languages import setActorLanguages
|
||||||
|
from utils import removeLineEndings
|
||||||
from utils import getBaseContentFromPost
|
from utils import getBaseContentFromPost
|
||||||
from utils import acctDir
|
from utils import acctDir
|
||||||
from utils import getImageExtensionFromMimeType
|
from utils import getImageExtensionFromMimeType
|
||||||
|
@ -4237,6 +4238,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# change password
|
# change password
|
||||||
if fields.get('password') and \
|
if fields.get('password') and \
|
||||||
fields.get('passwordconfirm'):
|
fields.get('passwordconfirm'):
|
||||||
|
fields['password'] = \
|
||||||
|
removeLineEndings(fields['password'])
|
||||||
|
fields['passwordconfirm'] = \
|
||||||
|
removeLineEndings(fields['passwordconfirm'])
|
||||||
if len(fields['password']) > 2 and \
|
if len(fields['password']) > 2 and \
|
||||||
fields['password'] == fields['passwordconfirm']:
|
fields['password'] == fields['passwordconfirm']:
|
||||||
# set password
|
# set password
|
||||||
|
|
8
utils.py
8
utils.py
|
@ -2606,3 +2606,11 @@ def validUrlPrefix(url: str) -> bool:
|
||||||
if url.startswith(pre):
|
if url.startswith(pre):
|
||||||
return True
|
return True
|
||||||
return False
|
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