Add functional login with SQL integration.

Implement login framework with SQL integration; everything's
functional, and nearly identical to the python-shelf version.
Still, rough edges (like lack of duplicate-check in the registration
script) remain; will iron out later.