forked from shaba/openuds
Fixed HTML5 window opening & MFA
This commit is contained in:
parent
05b6bebf36
commit
fcdf599e18
@ -160,7 +160,7 @@ class MFA(Module):
|
|||||||
try:
|
try:
|
||||||
if data and validity:
|
if data and validity:
|
||||||
# if we have a stored code, check if it's still valid
|
# if we have a stored code, check if it's still valid
|
||||||
if data[0] + datetime.timedelta(seconds=validity) < getSqlDatetime():
|
if data[0] + datetime.timedelta(seconds=validity) > getSqlDatetime():
|
||||||
# if it's still valid, just return without sending a new one
|
# if it's still valid, just return without sending a new one
|
||||||
return MFA.RESULT.OK
|
return MFA.RESULT.OK
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -189,8 +189,10 @@ class MFA(Module):
|
|||||||
data = self.storage.getPickle(storageKey)
|
data = self.storage.getPickle(storageKey)
|
||||||
if data and len(data) == 2:
|
if data and len(data) == 2:
|
||||||
validity = validity if validity is not None else self.validity() * 60
|
validity = validity if validity is not None else self.validity() * 60
|
||||||
if validity and data[0] + datetime.timedelta(seconds=validity) > getSqlDatetime():
|
if validity > 0 and data[0] + datetime.timedelta(seconds=validity) < getSqlDatetime():
|
||||||
# if it is no more valid, raise an error
|
# if it is no more valid, raise an error
|
||||||
|
# Remove stored code and raise error
|
||||||
|
self.storage.remove(storageKey)
|
||||||
raise exceptions.MFAError('MFA Code expired')
|
raise exceptions.MFAError('MFA Code expired')
|
||||||
|
|
||||||
# Check if the code is valid
|
# Check if the code is valid
|
||||||
|
@ -41,11 +41,11 @@ class EmailMFA(mfas.MFA):
|
|||||||
security = gui.ChoiceField(
|
security = gui.ChoiceField(
|
||||||
label=_('Security'),
|
label=_('Security'),
|
||||||
tooltip=_('Security protocol to use'),
|
tooltip=_('Security protocol to use'),
|
||||||
values=[
|
values={
|
||||||
gui.choiceItem('tls', _('TLS')),
|
'tls': _('TLS'),
|
||||||
gui.choiceItem('ssl', _('SSL')),
|
'ssl': _('SSL'),
|
||||||
gui.choiceItem('none', _('None')),
|
'none': _('None'),
|
||||||
],
|
},
|
||||||
order=2,
|
order=2,
|
||||||
required=True,
|
required=True,
|
||||||
tab=_('SMTP Server'),
|
tab=_('SMTP Server'),
|
||||||
|
@ -456,7 +456,7 @@ class HTML5RDPTransport(transports.Transport):
|
|||||||
'create-drive-path': 'true',
|
'create-drive-path': 'true',
|
||||||
'ticket-info': {
|
'ticket-info': {
|
||||||
'userService': userService.uuid,
|
'userService': userService.uuid,
|
||||||
'user': userService.user.uuid,
|
'user': userService.user.uuid if userService.user else '',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,12 +500,11 @@ class HTML5RDPTransport(transports.Transport):
|
|||||||
|
|
||||||
ticket = models.TicketStore.create(params, validity=self.ticketValidity.num())
|
ticket = models.TicketStore.create(params, validity=self.ticketValidity.num())
|
||||||
|
|
||||||
onw = ''
|
onw = '&o_n_w={}'.format(transport.uuid)
|
||||||
if self.forceNewWindow.value == gui.TRUE:
|
if self.forceNewWindow.value == gui.TRUE:
|
||||||
onw = '&o_n_w={}'
|
onw = '&o_n_w={}'.format(userService.deployed_service.uuid)
|
||||||
elif self.forceNewWindow.value == 'overwrite':
|
elif self.forceNewWindow.value == 'overwrite':
|
||||||
onw = '&o_s_w=yes'
|
onw = '&o_s_w=yes'
|
||||||
onw = onw.format(hash(transport.name))
|
|
||||||
path = (
|
path = (
|
||||||
self.customGEPath.value
|
self.customGEPath.value
|
||||||
if self.useGlyptodonTunnel.isTrue()
|
if self.useGlyptodonTunnel.isTrue()
|
||||||
|
@ -193,7 +193,7 @@ def mfa(request: ExtendedHttpRequest) -> HttpResponse:
|
|||||||
mfaInstance = mfaProvider.getInstance()
|
mfaInstance = mfaProvider.getInstance()
|
||||||
|
|
||||||
# Get validity duration
|
# Get validity duration
|
||||||
validity = min(mfaInstance.validity(), mfaProvider.validity * 60)
|
validity = min(mfaInstance.validity(), mfaProvider.validity) * 60
|
||||||
start_time = request.session.get('mfa_start_time', time.time())
|
start_time = request.session.get('mfa_start_time', time.time())
|
||||||
|
|
||||||
# If mfa process timed out, we need to start login again
|
# If mfa process timed out, we need to start login again
|
||||||
|
Loading…
Reference in New Issue
Block a user