Stellar flares and habitability