parent
e1a518720b
commit
5aad2aadff
|
@ -1,6 +1,31 @@
|
|||
import tempfile
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
from ietf.utils.pipe import pipe
|
||||
|
||||
|
||||
class EncriptedException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class EncriptedTextField(models.TextField):
|
||||
""" TODO: do the logic to store encripted text"""
|
||||
pass
|
||||
def pre_save(self, instance, add):
|
||||
if add:
|
||||
comments = getattr(instance, 'comments')
|
||||
position = getattr(instance, 'position')
|
||||
cert_file = position.nomcom.public_key.path
|
||||
comments_file = tempfile.NamedTemporaryFile()
|
||||
comments_file.write(comments)
|
||||
|
||||
code, out, error = pipe("%s smime -encrypt -in %s %s" % (settings.OPENSSL_COMMAND,
|
||||
comments_file.name,
|
||||
cert_file))
|
||||
comments_file.close()
|
||||
if not error:
|
||||
instance.comments = out
|
||||
return out
|
||||
else:
|
||||
raise EncriptedException(error)
|
||||
else:
|
||||
return instance.comments
|
||||
|
|
|
@ -261,9 +261,10 @@ IDSUBMIT_ANNOUNCE_LIST_EMAIL = 'i-d-announce@ietf.org'
|
|||
|
||||
# NomCom Tool settings
|
||||
ROLODEX_URL = ""
|
||||
PUBLIC_KEYS_URL = BASE_DIR + "/public_keys/"
|
||||
PUBLIC_KEYS_URL = BASE_DIR + '/public_keys/'
|
||||
NOMCOM_FROM_EMAIL = DEFAULT_FROM_EMAIL
|
||||
NOMCOM_ADMIN_EMAIL = DEFAULT_FROM_EMAIL
|
||||
OPENSSL_COMMAND = '/usr/bin/openssl'
|
||||
|
||||
# Days from meeting to cut off dates on submit
|
||||
FIRST_CUTOFF_DAYS = 19
|
||||
|
|
Loading…
Reference in a new issue