UserLogin - User/Session Management

This package handles session management in the typical Web way: user logs in, a session key is generated and dropped as a cookie on the hard drive. Susbsequent requests use that session key to validate the user. Logging out destroys this session key.

UserLogin gives you a hash of session data (name/value pairs) that stays the same throughout the user's session (time between logging in/logging out). Each user has his own similar data which you can retrieve using the package, as well. All this information is stored in the database and cached by UserLogin for faster access.

The system is configured via the database, and system-wide parameters can be easily read and changed from Perl (this allows you to use the system-wide stuff for your own system-wide variables).

UserLogin works with Mason, straight Perl, and (theoretically) CGI.

This package is licensed under the same terms as Mason itself. (The Artistic license.)

SourceForge Stuff

Kindly hosted by SourceForge Logo

SourceForge is kind of confusing, so here's a list of the places you probably want to go.

Changes


VersionDateDescription
Sep 6 2001 0.6.2
  • Mason permissions checking bugfix
Sep 4 2001 0.6.1
  • Zero admin fix
  • Cache size bugfix
Sep 3 2001 0.6
"Zero Administration" Version
  • Remove need for $sys and $session to be global
  • Make Perl script to perform all DB setup tasks
  • Add grant capability to SQL
  • Add host and port parameters for Postgres
  • Allow table name prefixes to be user-configurable
  • Arguments to new UserLogin::Postgres are now a hash for easier overriding
Aug 20 2001 0.5.2.1
Aug 14 2001 0.5.2
  • Fixed bug with timing on storing hashes in DB
  • Get rid of warnings on perl Makefile.PL
  • Added backward support for Postgres 7.0.2
Aug 10 2001 0.5.1
  • Backward support for Perl 5
Aug 9 2001 0.5 First public release, full functionality

Features

Basic session management info:

Installation

The system is separated into two parts: the base Perl library (which Mason calls to do most of the user and session data handling) and the Mason library and SQL.

Perl library

tar xzvf UserLogin-0.6.tar.gz
cd UserLogin-0.6
perl Makefile.PL
make
make install

SQL

cd sql
setup-postgres.pl <your db name>

Sample App

  1. Put all files from mason into a directory that will run Mason.
  2. Modify all instances of /~john/userlogin in autohandler to the path of your directory from the browser.
  3. Try it out and have fun!

Usage

Integrating into your app or starting a new app

  1. Copy mason/session and mason/util to a Mason directory of your choice (it doesn't matter where).
  2. Copy mason/login, logout, and register to your application directory.
  3. Copy the top of the mason/autohandler into your autohandler, down to the STUFF TO OVERRIDE IN CHILDREN comment. Customize init, header and footer as desired.
  4. Change the path and db attributes in autohandler to the path of your app (from the webserver, usually just "/") and database (same database as the SQL step)
  5. Write pages to your heart's content, using $session and $sys->{users}{$session->{_user_id}} as the session hash and user hash, respectively.

That is enough to get it up and running and pretty darn functional.

TODO

By John Keiser of WrightHaven.