Login and Logout views
----------------------

We have an app instance:

    >>> print http("""
    ... POST /@@contents.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 81
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... type_name=BrowserAdd__schoolbell.app.app.SchoolBellApplication\
    ... &new_value=frogpond
    ... """)
    HTTP/1.1 303 See Other
    ...

We add a person

    >>> print http("""
    ... POST /frogpond/persons/add.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 126
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... field.title=Some+User&field.username=user&field.password=secret\
    ... &field.verify_password=secret&field.photo=&UPDATE_SUBMIT=Add
    ... """)
    HTTP/1.1 303 See Other
    ...

We have the views @@login.html and @@logout.html on the main
application object.  Those views log in or log out the user of the
session.

    >>> print http(r"""
    ... GET /frogpond/@@login.html HTTP/1.1
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...

Incorrect password:

    >>> print http("""
    ... GET /frogpond/@@login.html?username=user&password=bad&LOGIN=Please\
    ...  HTTP/1.1
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...
                   href="http://localhost/frogpond/@@login.html">Log in</a>
    ...
        <p class="error">Username or password is incorrect</p>
    ...

Another attempt:

    >>> print http("""
    ... GET /frogpond/@@login.html?username=user&password=secret&LOGIN=Please\
    ...  HTTP/1.1
    ... """)
    HTTP/1.1 303 See Other
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...

Now we are authenticated:

    >>> print http("""
    ... GET /frogpond HTTP/1.1
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...
    ...Some User</a> |
    ...

Now we can log out:

    >>> print http("""
    ... GET /frogpond/@@logout.html HTTP/1.1
    ... """)
    HTTP/1.1 303 See Other
    ...

We are logged out:

    >>> print http("""
    ... GET /frogpond HTTP/1.1
    ... """)
    HTTP/1.1 200 Ok
    Content-Length: ...
    Content-Type: text/html;charset=utf-8
    <BLANKLINE>
    ...
                   href="http://localhost/frogpond/@@login.html">Log in</a>
    ...
