Authentication class to facilitate logging in users. It is assumed that there is a primary field that a user can be retrieved by, and a single password field upon which they authenticate with.
Given the appropriate parameters (lookup field,lookup value) the desired record is fetched from the database and the authentication method is executed.
Currently this method only really works when you are looking up by the class id, although there are plans to make this more flexible.
Given a login capable object, attempt to authenticate the user represented by the object.
-Verify that the object is an instance -Check the password and ensure it is correct -Check the status and make sure the user is permitted to login
If any criteria fail the appropriate exception is thrown and should be caught and handled properly
If all of these criteria are met the lastlogin field is updated to represent this successful login
Returns true if the 'password' stored in the params hash matches that of the current record, false for failed match or throws an exception otherwise.
BadPasswordException is thrown if the password is invalid
Generate a random string that is 8 characters long. This is useful for assigning random passwords to new users, after which you require them to change it after first login.