fixed cui post-auth queries for sqlite
fixed cui post-auth queries for mysql
added helpful comments to cui module
Merge pull request #412 from armitasp/master

cui sql fixes