mirror of
https://github.com/bringout/euro-office.git
synced 2026-04-23 17:02:05 +02:00
init: Euro-Office Odoo 16.0 modules
Based on onlyoffice_odoo by Ascensio System SIA (ONLYOFFICE, LGPL-3). Rebranded and adapted for Euro-Office by bring.out d.o.o. Modules: - eurooffice_odoo: base integration - eurooffice_odoo_templates: document templates - eurooffice_odoo_oca_dms: OCA DMS integration (replaces Enterprise documents) All references renamed: onlyoffice -> eurooffice, ONLYOFFICE -> Euro-Office. Original copyright notices preserved.
This commit is contained in:
commit
b59a9dc6bb
347 changed files with 16699 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# (c) Copyright Ascensio System SIA 2024
|
||||
#
|
||||
|
||||
import datetime
|
||||
|
||||
import jwt
|
||||
|
||||
from odoo.addons.eurooffice_odoo.utils import config_utils
|
||||
|
||||
|
||||
def is_jwt_enabled(env):
|
||||
return bool(config_utils.get_jwt_secret(env))
|
||||
|
||||
|
||||
def encode_payload(env, payload, secret=None):
|
||||
if secret is None:
|
||||
secret = config_utils.get_jwt_secret(env)
|
||||
now = datetime.datetime.utcnow()
|
||||
exp = now + datetime.timedelta(hours=24)
|
||||
payload["iat"] = int(now.timestamp())
|
||||
payload["exp"] = int(exp.timestamp())
|
||||
return jwt.encode(payload, secret, algorithm="HS256")
|
||||
|
||||
|
||||
def decode_token(env, token, secret=None):
|
||||
if secret is None:
|
||||
secret = config_utils.get_jwt_secret(env)
|
||||
return jwt.decode(token, secret, algorithms=["HS256"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue