diff --git a/odex25_mobile/odex_mobile/i18n/ar_001.po b/odex25_mobile/odex_mobile/i18n/ar_001.po index a0ffcf20e..4ee2f8c52 100644 --- a/odex25_mobile/odex_mobile/i18n/ar_001.po +++ b/odex25_mobile/odex_mobile/i18n/ar_001.po @@ -914,6 +914,12 @@ msgstr "منتهي الصلاحية" msgid "Is System" msgstr "هل النظام" +#. module: odex_mobile +#: model:ir.model.fields,field_description:odex_mobile.field_res_company__jwt_expire_days +#: model:ir.model.fields,field_description:odex_mobile.field_res_config_settings__jwt_expire_days +msgid "JWT expire (days)" +msgstr "انتهاء صلاحية JWT (أيام)" + #. module: odex_mobile #: code:addons/odex_mobile/controllers/authentication.py:0 #: code:addons/odex_mobile/controllers/rest_api_v2/authentication.py:0 diff --git a/odex25_mobile/odex_mobile/models/attendence_zone_config.py b/odex25_mobile/odex_mobile/models/attendence_zone_config.py index c33f36079..537e3a3bd 100644 --- a/odex25_mobile/odex_mobile/models/attendence_zone_config.py +++ b/odex25_mobile/odex_mobile/models/attendence_zone_config.py @@ -64,6 +64,7 @@ class ResConfigSettings(models.TransientModel): auto_checkout = fields.Integer(related="company_id.auto_checkout" ,string="Auto Checkout After",readonly=False) fcm_server_key = fields.Char(string='Server Key:', related="company_id.fcm_server_key", readonly=False) service_account = fields.Binary(string='Service Account:', related="company_id.service_account", readonly=False) + jwt_expire_days = fields.Integer(related='company_id.jwt_expire_days', readonly=False) sender_id = fields.Char(string='Sender ID:', related="company_id.sender_id", readonly=False) class ResCompany(models.Model): @@ -72,5 +73,6 @@ class ResCompany(models.Model): auto_checkout = fields.Integer(string="Auto Checkout After") fcm_server_key = fields.Char(string='Server Key') service_account = fields.Binary(string='Service Account', attachment=True) + jwt_expire_days = fields.Integer(string="JWT expire (days)", default=14) sender_id = fields.Char(string='Sender ID') diff --git a/odex25_mobile/odex_mobile/validator.py b/odex25_mobile/odex_mobile/validator.py index f3bffe1b7..8477ef252 100644 --- a/odex25_mobile/odex_mobile/validator.py +++ b/odex25_mobile/odex_mobile/validator.py @@ -97,10 +97,11 @@ class Validator: def create_token(self, user): try: - exp = datetime.datetime.utcnow() + datetime.timedelta(days=7) + now = datetime.datetime.now(datetime.timezone.utc) + exp = now + datetime.timedelta(days=user.company_id.jwt_expire_days or 14) payload = { 'exp': exp, - 'iat': datetime.datetime.utcnow(), + 'iat': now, 'sub': user['id'], 'lgn': user['login'], } diff --git a/odex25_mobile/odex_mobile/views/attendance_zone_config_view.xml b/odex25_mobile/odex_mobile/views/attendance_zone_config_view.xml index e457c5054..191803b0c 100644 --- a/odex25_mobile/odex_mobile/views/attendance_zone_config_view.xml +++ b/odex25_mobile/odex_mobile/views/attendance_zone_config_view.xml @@ -86,12 +86,12 @@

Odex SS App

-
-
-
+
+
+
+
@@ -104,6 +104,13 @@
+
+
+
+
+