Fix bug 1047018: Track successful log in/out

The try/catch block handles localStorage not being supported. When some browsers are in private browsing mode, <code>localStorage</code> is available but <code>setItem</code> throws an error.

https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js#L23-30