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 *finish*"> ObjectMethod finish <tt></tt></a></li>
12 <li><a href="#ObjectMethod <strong>fetchPass</strong> ($login"> ObjectMethod fetchPass <tt>($login) -> $passwordE</tt></a></li>
13 <li><a href="#ObjectMethod <strong>checkPassword</strong> ($u"> ObjectMethod checkPassword <tt>($user,$passwordU) -> $boolean</tt></a></li>
14 <li><a href="#ObjectMethod <strong>deleteUser</strong> ($user"> ObjectMethod deleteUser <tt>($user) -> $boolean</tt></a></li>
15 <li><a href="#ObjectMethod <strong>passwd</strong> ($user,$ne"> ObjectMethod passwd <tt>($user,$newPassU,$oldPassU) -> $boolean</tt></a></li>
16 <li><a href="#encrypt( $user, $passwordU, $fre"> encrypt( $user, $passwordU, $fresh ) -> $passwordE</a></li>
17 <li><a href="#ObjectMethod <strong>error</strong> () -> $stri"> ObjectMethod error <tt>() -> $string</tt></a></li>
18 <li><a href="#ObjectMethod <strong>getEmails</strong> ($user)"> ObjectMethod getEmails <tt>($user) -> @emails</tt></a></li>
19 <li><a href="#ObjectMethod <strong>setEmails</strong> ($user,"> ObjectMethod setEmails <tt>($user,@emails)</tt></a></li>
25 ## <a name="ClassMethod <strong>new</strong> ($session) - $"></a> [[ClassMethod]] **new** `($session) -> $object`
27 Constructs a new password handler of this type, referring to $session for any required TWiki services.
29 ## <a name="ObjectMethod <strong>finish*"></a><a name="ObjectMethod *finish</strong> "></a> [[ObjectMethod]] **finish** ``
31 Complete processing after the client's HTTP request has been responded to.
33 1. breaking circular references to allow garbage collection in persistent environments
35 ## <a name="ObjectMethod <strong>fetchPass</strong> ($login"></a> [[ObjectMethod]] **fetchPass** `($login) -> $passwordE`
37 Implements TWiki::Password
39 Returns encrypted password if succeeds. Returns 0 if login is invalid. Returns undef otherwise.
41 ## <a name="ObjectMethod <strong>checkPassword</strong> ($u"></a> [[ObjectMethod]] **checkPassword** `($user,$passwordU) -> $boolean`
43 Finds if the password is valid for the given login.
45 Returns 1 on success, undef on failure.
47 ## <a name="ObjectMethod <strong>deleteUser</strong> ($user"></a> [[ObjectMethod]] **deleteUser** `($user) -> $boolean`
51 Returns 1 on success, undef on failure.
53 ## <a name="ObjectMethod <strong>passwd</strong> ($user,$ne"></a> [[ObjectMethod]] **passwd** `($user,$newPassU,$oldPassU) -> $boolean`
55 If the $oldPassU is undef, it will try to add the user, failing if they are already there.
57 If the $oldPassU matches matches the login's password, then it will replace it with $newPassU.
59 If $oldPassU is not correct and not 1, will return 0.
61 If $oldPassU is 1, will force the change irrespective of the existing password, adding the user if necessary.
63 Otherwise returns 1 on success, undef on failure.
65 ## <a name="encrypt( $user, $passwordU, $fre"></a> encrypt( $user, $passwordU, $fresh ) -> $passwordE
67 Will return an encrypted password. Repeated calls to encrypt with the same user/passU will return the same passE.
69 However if the passU is changed, and subsequently changed _back_ to the old user/passU pair, then the old passE is no longer valid.
71 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.
73 ## <a name="ObjectMethod <strong>error</strong> () - $strin"></a> [[ObjectMethod]] **error** `() -> $string`
75 Return any error raised by the last method call, or undef if the last method call succeeded.
77 ## <a name="ObjectMethod <strong>getEmails</strong> ($user)"></a> [[ObjectMethod]] **getEmails** `($user) -> @emails`
79 Fetch the email address(es) for the given username. Default behaviour is to look up the users' personal topic.
81 ## <a name="ObjectMethod <strong>setEmails</strong> ($user,"></a> [[ObjectMethod]] **setEmails** `($user,@emails)`
83 Set the email address(es) for the given username in the user topic.