1 # <a name="Package <code>TWiki::Users::Password="></a> Package =TWiki::Users::Password
3 Base class of all password handlers. Default behaviour is no passwords, so anyone can be anyone they like.
5 The methods of this class should be overridded by subclasses that want to implement other password handling methods.
9 <li><a href="#Package =TWiki::Users::Password="> Package TWiki::Users::Password</a><ul>
10 <li><a href="#ClassMethod <strong>new</strong> ($session) ->"> ClassMethod new <tt>($session) -> $object</tt></a></li>
11 <li><a href="#ObjectMethod <strong>fetchPass</strong> ($login"> ObjectMethod fetchPass <tt>($login) -> $passwordE</tt></a></li>
12 <li><a href="#ObjectMethod <strong>checkPassword</strong> ($u"> ObjectMethod checkPassword <tt>($user,$passwordU) -> $boolean</tt></a></li>
13 <li><a href="#ObjectMethod <strong>deleteUser</strong> ($user"> ObjectMethod deleteUser <tt>($user) -> $boolean</tt></a></li>
14 <li><a href="#ObjectMethod <strong>passwd</strong> ($user,$ne"> ObjectMethod passwd <tt>($user,$newPassU,$oldPassU) -> $boolean</tt></a></li>
15 <li><a href="#encrypt( $user, $passwordU, $fre"> encrypt( $user, $passwordU, $fresh ) -> $passwordE</a></li>
16 <li><a href="#ObjectMethod <strong>error</strong> () -> $stri"> ObjectMethod error <tt>() -> $string</tt></a></li>
17 <li><a href="#ObjectMethod <strong>getEmails</strong> ($user)"> ObjectMethod getEmails <tt>($user) -> @emails</tt></a></li>
18 <li><a href="#ObjectMethod <strong>setEmails</strong> ($user,"> ObjectMethod setEmails <tt>($user,@emails)</tt></a></li>
24 ## <a name="ClassMethod <strong>new</strong> ($session) - $"></a> [[ClassMethod]] **new** `($session) -> $object`
26 Constructs a new password handler of this type, referring to $session for any required TWiki services.
28 ## <a name="ObjectMethod <strong>fetchPass</strong> ($login"></a> [[ObjectMethod]] **fetchPass** `($login) -> $passwordE`
30 Implements TWiki::Password
32 Returns encrypted password if succeeds. Returns 0 if login is invalid. Returns undef otherwise.
34 ## <a name="ObjectMethod <strong>checkPassword</strong> ($u"></a> [[ObjectMethod]] **checkPassword** `($user,$passwordU) -> $boolean`
36 Finds if the password is valid for the given login.
38 Returns 1 on success, undef on failure.
40 ## <a name="ObjectMethod <strong>deleteUser</strong> ($user"></a> [[ObjectMethod]] **deleteUser** `($user) -> $boolean`
44 Returns 1 on success, undef on failure.
46 ## <a name="ObjectMethod <strong>passwd</strong> ($user,$ne"></a> [[ObjectMethod]] **passwd** `($user,$newPassU,$oldPassU) -> $boolean`
48 If the $oldPassU is undef, it will try to add the user, failing if they are already there.
50 If the $oldPassU matches matches the login's password, then it will replace it with $newPassU.
52 If $oldPassU is not correct and not 1, will return 0.
54 If $oldPassU is 1, will force the change irrespective of the existing password, adding the user if necessary.
56 Otherwise returns 1 on success, undef on failure.
58 ## <a name="encrypt( $user, $passwordU, $fre"></a> encrypt( $user, $passwordU, $fresh ) -> $passwordE
60 Will return an encrypted password. Repeated calls to encrypt with the same user/passU will return the same passE.
62 However if the passU is changed, and subsequently changed _back_ to the old user/passU pair, then the old passE is no longer valid.
64 If $fresh is true, then a new password not based on any pre-existing salt will be used. Set this if you are generating a completely new password.
66 ## <a name="ObjectMethod <strong>error</strong> () - $strin"></a> [[ObjectMethod]] **error** `() -> $string`
68 Return any error raised by the last method call, or undef if the last method call succeeded.
70 ## <a name="ObjectMethod <strong>getEmails</strong> ($user)"></a> [[ObjectMethod]] **getEmails** `($user) -> @emails`
72 Fetch the email address(es) for the given username. Default behaviour is to look up the users' personal topic.
74 ## <a name="ObjectMethod <strong>setEmails</strong> ($user,"></a> [[ObjectMethod]] **setEmails** `($user,@emails)`
76 Set the email address(es) for the given username in the user topic.