mirror of https://gitlab.com/bashrc2/epicyon
Simpler password validation
parent
200a4bff31
commit
07072d8e7c
17
tests.py
17
tests.py
|
@ -4271,14 +4271,6 @@ def _testGetLinksFromContent():
|
|||
assert '>@linked</a>' in content
|
||||
|
||||
|
||||
def _testValidPassword():
|
||||
print('testValidPassword')
|
||||
assert not validPassword('123')
|
||||
assert not validPassword('')
|
||||
assert not validPassword('Abcdefg1?23456')
|
||||
assert validPassword('Abcdef!g123456')
|
||||
|
||||
|
||||
def _testAuthorizeSharedItems():
|
||||
print('testAuthorizeSharedItems')
|
||||
sharedItemsFederatedDomains = \
|
||||
|
@ -4328,6 +4320,15 @@ def _testDateConversions() -> None:
|
|||
assert dateStr == dateStr2
|
||||
|
||||
|
||||
def _testValidPassword():
|
||||
print('testValidPassword')
|
||||
assert not validPassword('123')
|
||||
assert not validPassword('')
|
||||
assert validPassword('パスワード12345')
|
||||
assert validPassword('测试密码12345')
|
||||
assert validPassword('A!bc:defg1/234?56')
|
||||
|
||||
|
||||
def runAllTests():
|
||||
print('Running tests...')
|
||||
updateDefaultThemesList(os.getcwd())
|
||||
|
|
2
utils.py
2
utils.py
|
@ -2641,8 +2641,6 @@ def validPassword(password: str) -> bool:
|
|||
"""
|
||||
if len(password) < 8:
|
||||
return False
|
||||
if not re.match("^[a-zA-Z0-9!]*$", password):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -176,8 +176,8 @@ def htmlLogin(cssCache: {}, translate: {},
|
|||
' <label for="password"><b>' + \
|
||||
translate['Password'] + '</b></label>\n' + \
|
||||
' <input type="password" ' + autocompleteStr + \
|
||||
' placeholder="' + translate['Enter Password'] + ' A-Za-z0-9" ' + \
|
||||
'pattern="[A-Za-z0-9!]{8,}" name="password" required>\n' + \
|
||||
' placeholder="' + translate['Enter Password'] + '" ' + \
|
||||
'pattern="{8,}" name="password" required>\n' + \
|
||||
loginButtonStr + registerButtonStr + '\n' + \
|
||||
' </div>\n' + \
|
||||
'</form>\n' + \
|
||||
|
|
Loading…
Reference in New Issue