Let $D$ be a non-square integer such that $D \equiv 1$ (mod $4$). Let $\chi\colon (\mathbb{Z}/D\mathbb{Z})^\times\rightarrow \mathbb{Z}^\times = \{-1, 1\}$ be the map defined in this question. Let $n$ be an integer. We denote by $[n]$, the image of $n$ by the canonical map $\mathbb{Z} \rightarrow \mathbb{Z}/D\mathbb{Z}$. Computing values of $\chi$ at $[2]$ for several $D$s, it seems that $\chi([2]) = 1$ if $D \equiv 1$ (mod $8$) and $\chi([2]) = -1$ if $D \equiv 5$ (mod $8$).
Is this true? If yes, how can we prove it?