1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-23 17:34:17 +03:00

Fixed choiceField bug & MFA table

This commit is contained in:
Adolfo Gómez García 2022-10-13 14:47:37 +02:00
parent c6d1bf450c
commit 9f2bc5417f
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
6 changed files with 24 additions and 14 deletions

View File

@ -125,17 +125,17 @@ class gui:
def choiceFromValue(val: typing.Union[str, typing.Dict[str, str]]) -> typing.Dict[str, str]:
if isinstance(val, str):
return {'id': val, 'text': val}
# Return a deepcopy
return copy.deepcopy(val)
# If is an iterator
if isinstance(vals, abc.Iterable):
return [choiceFromValue(v) for v in vals]
# If is a dict
if isinstance(vals, abc.Mapping):
return [{'id': str(k), 'text': v} for k, v in vals.items()]
# If is an iterator
if isinstance(vals, abc.Iterable):
return [choiceFromValue(v) for v in vals]
raise ValueError('Invalid type for convertToChoices: {}'.format(type(vals)))
@staticmethod

View File

@ -189,7 +189,7 @@ class EmailMFA(mfas.MFA):
# Populate the networks list
cls.networks.setValues([
gui.choiceItem(v.uuid, v.name)
for v in models.Network.objects.all().order_by('name')
for v in models.Network.objects.all().order_by('name') if v.uuid
])

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,7 @@ gettext("provider");
gettext("service");
gettext("service pool");
gettext("authenticator");
gettext("MFA");
gettext("user");
gettext("group");
gettext("transport");
@ -266,9 +267,9 @@ gettext("Assigned services");
gettext("New Authenticator");
gettext("Edit Authenticator");
gettext("Delete Authenticator");
gettext("New Authenticator");
gettext("Edit Authenticator");
gettext("Delete Authenticator");
gettext("New MFA");
gettext("Edit MFA");
gettext("Delete MFA");
gettext("Error saving: ");
gettext("Error saving element");
gettext("Error handling your request");

View File

@ -99,7 +99,7 @@
</svg>
</div>
</uds-root>
<script src="/uds/res/admin/runtime.js?stamp=1656962877" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1656962877" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1656962877" defer></script><script src="/uds/res/admin/main.js?stamp=1656962877" defer></script>
<script src="/uds/res/admin/runtime.js?stamp=1665662924" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1665662924" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1665662924" defer></script><script src="/uds/res/admin/main.js?stamp=1665662924" defer></script>
</body></html>

View File

@ -34,6 +34,9 @@ import datetime
import re
import logging
import typing
from urllib.parse import urlencode
from regex import W
from uds.models.util import getSqlDatetime
from django.utils.translation import ugettext_noop as _
@ -388,7 +391,7 @@ class HTML5RDPTransport(transports.Transport):
domain = self.fixedDomain.value
if self.useEmptyCreds.isTrue():
username, passwd, domain = '', '', ''
username, password, domain = '', '', ''
if self.withoutDomain.isTrue():
domain = ''
@ -460,6 +463,11 @@ class HTML5RDPTransport(transports.Transport):
},
}
if password == '' and self.security.value != 'rdp':
extra_params='&' + urlencode({'username': username, 'domain': domain, 'reqcreds': 'true'})
else:
extra_params=''
if False: # Future imp
sanitize = lambda x: re.sub("[^a-zA-Z0-9_-]", "_", x)
params['recording-path'] = (
@ -515,11 +523,12 @@ class HTML5RDPTransport(transports.Transport):
path = path[:-1]
return str(
"{server}{path}/#/?data={ticket}.{scrambler}{onw}".format(
"{server}{path}/#/?data={ticket}.{scrambler}{onw}{extra_params}".format(
server=self.guacamoleServer.value,
path=path,
ticket=ticket,
scrambler=scrambler,
onw=onw,
extra_params=extra_params,
)
)