3 This is a template for a password changing mechanism. Currently,
4 this contains two parts: the first is to register your function
5 in the squirrelmail_plugin_hooks global, and the second is
6 the function that does the actual changing.
8 Replace the word template everywhere with a name for your backend.
12 * Config vars: here's room for config vars specific to your
17 * Define here the name of your password changing function.
19 global $squirrelmail_plugin_hooks;
20 $squirrelmail_plugin_hooks['change_password_dochange']['template'] =
21 'cpw_template_dochange';
22 $squirrelmail_plugin_hooks['change_password_init']['template'] =
27 * Use this function to do any backend-specific initialization,
28 * e.g. checking requirements, before the password change form
29 * is displayed to the user.
31 function cpw_template_init()
38 * This is the function that is specific to your backend. It takes
39 * the current password (as supplied by the user) and the desired
40 * new password. It will return an array of messages. If everything
41 * was successful, the array will be empty. Else, it will contain
42 * the errormessage(s).
43 * Constants to be used for these messages:
44 * CPW_CURRENT_NOMATCH -> "Your current password is not correct."
45 * CPW_INVALID_PW -> "Your new password contains invalid characters."
47 * @param array data The username/currentpw/newpw data.
48 * @return array Array of error messages.
50 function cpw_template_dochange($data)
52 // unfortunately, we can only pass one parameter to a hook function,
53 // so we have to pass it as an array.
54 $username = $data['username'];
55 $curpw = $data['curpw'];
56 $newpw = $data['newpw'];
60 // your code here to change the password for $username from
61 // $currentpw into $newpw.
62 user_error('No valid backend defined: this is just a template', E_USER_ERROR
);