fixed https://github.com/globaleaks/GlobaLeaks/issues/765 and completed some code related to encrypted/plaintext templates