Fix login redirect. See #1046