Bugfix: encryption lockout
This commit is contained in:
		@@ -26,6 +26,8 @@ services:
 | 
				
			|||||||
      - ./.env
 | 
					      - ./.env
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - 5000
 | 
					      - 5000
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./.security:/ref-test/.security
 | 
				
			||||||
    restart: unless-stopped
 | 
					    restart: unless-stopped
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      - frontend
 | 
					      - frontend
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,17 +2,17 @@ from os import environ, path
 | 
				
			|||||||
from cryptography.fernet import Fernet
 | 
					from cryptography.fernet import Fernet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def generate_keyfile():
 | 
					def generate_keyfile():
 | 
				
			||||||
    with open('./common/security/.encryption.key', 'wb') as keyfile:
 | 
					    with open('.security/.encryption.key', 'wb') as keyfile:
 | 
				
			||||||
        key = Fernet.generate_key()
 | 
					        key = Fernet.generate_key()
 | 
				
			||||||
        keyfile.write(key)
 | 
					        keyfile.write(key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def load_key():
 | 
					def load_key():
 | 
				
			||||||
    with open('./common/security/.encryption.key', 'rb') as keyfile:
 | 
					    with open('.security/.encryption.key', 'rb') as keyfile:
 | 
				
			||||||
        key = keyfile.read()
 | 
					        key = keyfile.read()
 | 
				
			||||||
        return key
 | 
					        return key
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_keyfile_exists():
 | 
					def check_keyfile_exists():
 | 
				
			||||||
    return path.isfile('./common/security/.encryption.key')
 | 
					    return path.isfile('.security/.encryption.key')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def encrypt(input):
 | 
					def encrypt(input):
 | 
				
			||||||
    if not check_keyfile_exists():
 | 
					    if not check_keyfile_exists():
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user