Added "autocomplete off" to forms

This commit is contained in:
Adolfo Gómez García 2020-06-22 16:00:59 +02:00
parent fdd241194d
commit 96945e7834
6 changed files with 16 additions and 11 deletions

View File

@ -239,7 +239,6 @@ class Handler:
:param staf_member: If user is considered staff member or not
"""
session = SessionStore()
session.set_expiry(GlobalConfig.ADMIN_IDLE_TIME.getInt())
Handler.storeSessionAuthdata(session, id_auth, username, password, locale, platform, is_admin, staf_member, scrambler)
session.save()
self._authToken = session.session_key

View File

@ -41,11 +41,16 @@ logger = logging.getLogger(__name__)
# Pair of section/value removed from current UDS version
REMOVED = {
'UDS': ('allowPreferencesAccess', 'customHtmlLogin', 'UDS Theme', 'UDS Theme Enhaced', 'css', 'allowPreferencesAccess', 'loginUrl'),
'UDS': (
'allowPreferencesAccess', 'customHtmlLogin', 'UDS Theme',
'UDS Theme Enhaced', 'css', 'allowPreferencesAccess',
'loginUrl', 'maxLoginTries', 'loginBlockTime'
),
'Cluster': ('Destination CPU Load', 'Migration CPU Load', 'Migration Free Memory'),
'IPAUTH': ('autoLogin',),
'VMWare': ('minUsableDatastoreGB', 'maxRetriesOnError'),
'HyperV': ('minUsableDatastoreGB',)
'HyperV': ('minUsableDatastoreGB',),
'Security': ('adminIdleTime', 'userSessionLength'),
}

View File

@ -254,7 +254,7 @@ class GlobalConfig:
# Login URL: deprecated & not used anymore
# LOGIN_URL: Config.Value = Config.section(GLOBAL_SECTION).value('loginUrl', '/uds/page/login', type=Config.TEXT_FIELD) # Defaults to /login
# Session duration
USER_SESSION_LENGTH: Config.Value = Config.section(SECURITY_SECTION).value('userSessionLength', '14400', type=Config.NUMERIC_FIELD) # Defaults to 4 hours
# USER_SESSION_LENGTH: Config.Value = Config.section(SECURITY_SECTION).value('userSessionLength', '14400', type=Config.NUMERIC_FIELD) # Defaults to 4 hours
# Superuser (do not need to be at database!!!)
SUPER_USER_LOGIN: Config.Value = Config.section(SECURITY_SECTION).value('superUser', 'root', type=Config.TEXT_FIELD)
# Superuser password (do not need to be at database!!!)
@ -262,7 +262,7 @@ class GlobalConfig:
# Idle time before closing session on admin
SUPER_USER_ALLOW_WEBACCESS: Config.Value = Config.section(SECURITY_SECTION).value('allowRootWebAccess', '1', type=Config.BOOLEAN_FIELD)
# Time an admi session can be idle before being "logged out"
ADMIN_IDLE_TIME: Config.Value = Config.section(SECURITY_SECTION).value('adminIdleTime', '14400', type=Config.NUMERIC_FIELD) # Defaults to 4 hous
# ADMIN_IDLE_TIME: Config.Value = Config.section(SECURITY_SECTION).value('adminIdleTime', '14400', type=Config.NUMERIC_FIELD) # Defaults to 4 hous
# Time betwen checks of unused services by os managers
# Unused services will be invoked for every machine assigned but not in use AND that has been assigned at least this time
# (only if os manager asks for this characteristic)
@ -270,9 +270,10 @@ class GlobalConfig:
# Default CSS Used
# CSS: Config.Value = Config.section(GLOBAL_SECTION).value('css', settings.STATIC_URL + 'css/uds.css', type=Config.TEXT_FIELD)
# Max logins before blocking an account
MAX_LOGIN_TRIES: Config.Value = Config.section(GLOBAL_SECTION).value('maxLoginTries', '3', type=Config.NUMERIC_FIELD)
MAX_LOGIN_TRIES: Config.Value = Config.section(SECURITY_SECTION).value('maxLoginTries', '5', type=Config.NUMERIC_FIELD)
# Block time in second for an user that makes too many mistakes, 5 minutes default
LOGIN_BLOCK: Config.Value = Config.section(GLOBAL_SECTION).value('loginBlockTime', '300', type=Config.NUMERIC_FIELD)
LOGIN_BLOCK: Config.Value = Config.section(SECURITY_SECTION).value('loginBlockTime', '300', type=Config.NUMERIC_FIELD)
LOGIN_BLOCK_IP: Config.Value = Config.section(SECURITY_SECTION).value('Block ip on login failure', '0', type=Config.BOOLEAN_FIELD)
# Do autorun of service if just one service.
# 0 = No autorun, 1 = Autorun at login
# In a future, maybe necessary another value "2" that means that autorun always
@ -326,7 +327,7 @@ class GlobalConfig:
LIMITED_BY_CALENDAR_TEXT: Config.Value = Config.section(GLOBAL_SECTION).value('Calendar access denied text', '', type=Config.TEXT_FIELD) # Defaults to Nothing
# Custom message for error when limiting by calendar
# This is used so templates can change "styles" from admin interface
# If convert username to lowercase
LOWERCASE_USERNAME: Config.Value = Config.section(SECURITY_SECTION).value('Convert username to lowercase', '1', type=Config.BOOLEAN_FIELD)
# Global UDS ID (common for all servers on the same cluster)

File diff suppressed because one or more lines are too long

View File

@ -92,6 +92,6 @@
</svg>
</div>
</uds-root>
<script src="/uds/res/admin/runtime.js?stamp=1591879345" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1591879345" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1591879345" defer></script><script src="/uds/res/admin/main.js?stamp=1591879345" defer></script></body>
<script src="/uds/res/admin/runtime.js?stamp=1592833442" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1592833442" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1592833442" defer></script><script src="/uds/res/admin/main.js?stamp=1592833442" defer></script></body>
</html>

View File

@ -91,7 +91,7 @@ def checkLogin( # pylint: disable=too-many-branches, too-many-statements
cache = Cache('auth')
cacheKey = str(authenticator.id) + userName
tries = cache.get(cacheKey) or 0
triesByIp = cache.get(request.ip) or 0
triesByIp = (cache.get(request.ip) or 0) if GlobalConfig.LOGIN_BLOCK_IP.getBool() else 0
maxTries = GlobalConfig.MAX_LOGIN_TRIES.getInt()
if (authenticator.getInstance().blockUserOnLoginFailures is True and (tries >= maxTries) or triesByIp >= maxTries):
authLogLogin(request, authenticator, userName, 'Temporarily blocked')