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

added timeout value

This commit is contained in:
Adolfo Gómez García 2022-06-23 15:56:14 +02:00
parent 5b499de983
commit 43934d425f
3 changed files with 19 additions and 6 deletions

View File

@ -50,11 +50,7 @@ logger = logging.getLogger(__name__)
class Notifiers(ModelHandler):
path = 'mfa'
model = models.MFA
save_fields = [
'name',
'comments',
'tags',
]
save_fields = ['name', 'comments', 'tags', 'cache_device']
table_title = _('Notifiers')
table_fields = [
@ -76,6 +72,20 @@ class Notifiers(ModelHandler):
localGui = self.addDefaultFields(
mfa.guiDescription(), ['name', 'comments', 'tags']
)
self.addField(
localGui,
{
'name': 'cache_device',
'value': '0',
'minValue': '0',
'label': gettext('Device Caching'),
'tooltip': gettext(
'Time in hours to cache device so MFA is not required again. User based.'
),
'type': gui.InputField.NUMERIC_TYPE,
'order': 111,
},
)
return localGui

View File

@ -1,4 +1,4 @@
# Generated by Django 3.2.10 on 2022-06-22 21:33
# Generated by Django 3.2.10 on 2022-06-23 15:55
from django.db import migrations, models
import django.db.models.deletion
@ -20,6 +20,7 @@ class Migration(migrations.Migration):
('data_type', models.CharField(max_length=128)),
('data', models.TextField(default='')),
('comments', models.CharField(max_length=256)),
('cache_device', models.IntegerField(default=0)),
('tags', models.ManyToManyField(to='uds.Tag')),
],
options={

View File

@ -55,6 +55,8 @@ class MFA(ManagedObjectModel, TaggingMixin): # type: ignore
objects: 'models.BaseManager[MFA]'
authenticators: 'models.manager.RelatedManager[Authenticator]'
cache_device = models.IntegerField(default=0) # Time to cache the device MFA in hours
def getInstance(
self, values: typing.Optional[typing.Dict[str, str]] = None
) -> 'mfas.MFA':