secret for computing invoice hash added
This commit is contained in:
parent
ba1a531313
commit
064a5b422d
|
@ -5,6 +5,7 @@ import os
|
|||
import requests
|
||||
import logging
|
||||
from hashlib import sha256
|
||||
import hmac
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.conf import settings
|
||||
|
@ -31,9 +32,10 @@ class Command(BaseCommand):
|
|||
email_subject = 'Nouvelle facture'
|
||||
email_template = 'invoice_mail.txt'
|
||||
email_from = settings.DEFAULT_FROM_EMAIL
|
||||
secret = settings.INVOICE_HASHING_SECRET
|
||||
|
||||
def get_invoice_hash(self, *args):
|
||||
hash = sha256(''.join(map(lambda s: str(s), args)))
|
||||
hash = hmac.HMAC(self.secret, digestmod=sha256, msg=''.join(map(lambda s: str(s), args)))
|
||||
return hash.hexdigest()[:8]
|
||||
|
||||
|
||||
|
|
|
@ -169,6 +169,8 @@ EMAILING_APIKEY = os.environ.get('EMAILING_APIKEY', '12345')
|
|||
|
||||
INVOICE_VIEW_URL_BASE = PORTAIL_CITOYEN_URL + '/facture/simple/tipi'
|
||||
|
||||
INVOICE_HASHING_SECRET = '12345'
|
||||
|
||||
IDP_USER_INFO_URL = '%s/userinfo' % IDP_URL
|
||||
|
||||
try:
|
||||
|
|
Reference in New Issue