authenticate using email and not login as at time login field is blank. Also generate api key if it is nil