catch exception and properly redirect on failed login.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| Refs tickets  | #900, #1643, #1413
| License       | MIT
| Doc PR        | -

refs #900, #1643, #1413