|
as a class. It is instantiated by:
var srp = new SRP(username, password, server_type, base_url);
Then it is run by calling:
srp.register()
to register a new user, and
srp.identify()
to authenticate an existing user. By default, a successful
identification pops up an alert reading "Authentication Successful."
To change this, set srp.success to a function. For example,
srp.success = function()
{
alert("We win!");
}
The same is true for error messages. By default, the SRP library sends
the message to the user as an alert box, but web designers can replace
the srp.error_message function to handle the error messages differently.
The most significant part of making the SRP library into a class is that
it cleans up the namespace. Instead of having tons of srp_Variables, we
only add the SRP() function to the namespace, and all other variables
are either private, public, or protected members of that class.
A few minor edits were made to views.py to support logging in with the
modified library. I haven't made the modifications to register yet, so
it won't work for this revision. Oops.
|