Solution (source code)

= Solution

Introduce the electromagnetic <electromagnetic field tensor> $F_{\mu\nu}=\partial_\mu A_\nu-\partial_\nu A_\mu$ and the charged vector field strength $\mathcal G_{\mu\nu}=D_\mu B_\nu-D_\nu B_\mu$, with $D_\mu=\partial_\mu+ieA_\mu$. <Minimal coupling> gives
$$
\boxed{\mathcal L_{\rm tot}=-\frac14F_{\mu\nu}F^{\mu\nu}-\frac12\mathcal G_{\mu\nu}^*\mathcal G^{\mu\nu}+M^2B_\mu^*B^\mu.}
$$
Under $B_\mu'=e^{i\alpha(x)}B_\mu$ and $A_\mu'=A_\mu-\partial_\mu\Lambda$,
$$
D_\mu'B_\nu'=e^{i\alpha}\left[D_\mu B_\nu+i(\partial_\mu\alpha-e\partial_\mu\Lambda)B_\nu\right].
$$
Consequently the required relation is
$$
\boxed{\partial_\mu\alpha=e\partial_\mu\Lambda,\qquad\alpha=e\Lambda+\text{constant}.}
$$
Then $\mathcal G_{\mu\nu}'=e^{i\alpha}\mathcal G_{\mu\nu}$, its complex conjugate transforms oppositely, the mass bilinear is invariant, and $F_{\mu\nu}'=F_{\mu\nu}$. Each term in the total <Lagrangian density> is therefore invariant under the electromagnetic <U(1) gauge symmetry>. This phase <gauge symmetry> does not reinstate the broken gradient-shift <gauge symmetry> of the massive field itself.