A drug delivery device for administering a drug is presented having a body adapted to retain a cartridge containing a drug, at least one electrical unit and a port for electrically contacting the electrical unit, an adapter for attaching an injection needle to the drug delivery device, a safety mechanism arranged to prevent access to the port whilst an injection needle is in fluid communication with the cartridge and arranged to prevent establishing a fluid communication between an injection needle and the cartridge whilst the port is accessible.