modified login to return error array instead of throwing exception