refactored settings sessions handling a bit.

incorporated require_valid_user couchdb config update into settings.