Fix login errors and success handling