fix JS sign-out (closes #2991)
add a regression test
Merge pull request #3008 from gratipay/fix-js-sign-out

Fix JS sign-out