A holographic superconductor in an external magnetic field