Fix login redirect bugs