Changed login to consider mid as well as email