Add rbt login/logout commands.

Review Request #7019 — Created March 7, 2015 and submitted — Latest diff uploaded




Currently, if people want to get a valid session cookie for RBTools,
they must invoke a command out of a repository and wait to be prompted
for a username and password. This isn't always suitabl for all

The new rbt login command will prompt the user for credentials, or take
them on the command line using --username and --password. It will then
verify that the login session is valid, and print a success message.

rbt logout will log the user out of the session on the server and remove
the cookie from .rbtools-cookies.

The login prompt and interaction has improved as well. Previously, it
had a sort of long message and the user had one attempt to log in before
getting a general error message. Now, the messages are shorter and
simpler, and users get 3 tries.

The other login prompts (the ones that appear as the result of a
HTTP 401) have been updated to match the text of the
get_authenticated_session login prompt.

Deleted my cookie and logged in using rbt login. Saw that the cookie
was saved and I could make requests.

Tested inputting invalid credentials 3 times. The last time, it bailed with
a suitable error. All previous times, it gave me a suitable error about the
username/password being incorrect.

Tried using rbt login again. Saw a message about already being logged in.

I then deleted the cookie and tried with --username and --password. It
also successfully logged in.

Used rbt logout to log out of the session. It was successful, and the cookie
was removed from my cookies file.

Tested the login prompt from rbt post.