> Additionally the purser should have some kind of emergency door opening code or device.
They do.
On the A320 there is a 'door lock' switch on the center pedestal: Unlock, Lock, Override. In the override position, the external keypad is disabled to protect the pilots from a FA under duress.
Additionally; the cockpit has a good olde mechanical slide-like lock.