Upgrade cfoundry to 0.5.0 and fix login method

Change-Id: I0d346ef6bd6acf864b437a3f957d819061e1e70d