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 contacting the electrical unit through 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 configured to allow contacting the electrical unit.