Implement two factor authentication

If enabled, require a second factor to acquire a session cookie and
reject basic authentication attempts (as second factor cannot be
presented). Allow previous and next token for clock skew.
extract couch_httpd changes API in its own module
add supports of view changes in the _changes API

Now when the option `seq_indexed=true` is set in the design doc, the
view filter in _changes will use it to retrieve the results. Compared to
the current way, using a view index will be faster to retrieve changes.
It also gives the possibility to filter changes by key or get changes in
a key range. All the view options can be used.

Note 1: if someone is trying to filter a changes with view options when
the views are not indexed by sequence, a 400 error will be returned.
Note 2: The changes will only be returned when the view is updated if
seq_indexed=true
couch_httpd_changes: check removed keys from the view filter

Make sure to only emit deleted document when a deleted key is passed to
the view filter.

Conflicts:
	src/couch_httpd_changes.erl
Add preliminary version of view changes
Add view filtering optimization to changes feeds
Add rev to view changes respose. See couch_mrview for corresponding changes
Open view in changes start function rather than outside
Make include_docs=true work for view changes
Refactor code for sanity and so the view changes handler can reuse code better
Add comment and do minor refactoring
Change return format of _view_changes

This commit makes KV pairs for _view_changes requests be returned in the
format:

    {..."add": [["key", "val"],["key2", "val2"]], "remove": ["oldkey"]}

Note that the "add" field is a list of lists rather than an object
because: 1) there can be multiple values for a given key and 2) keys can
be non-strings (non-string keys are invalid JSON).

Also note that if a view update causes adds or removes some (but not
all) values for a given key, all values associated with that key will be
returned in the _view_changes response.