Index: openacs-4/packages/acs-authentication/tcl/local-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.tcl,v diff -u -N -r1.30 -r1.31 --- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 4 Jun 2006 00:45:21 -0000 1.30 +++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 19 Oct 2006 12:54:57 -0000 1.31 @@ -233,8 +233,8 @@ Implements the CanRetrievePassword operation of the auth_password service contract for the local account implementation. } { - # Nope, passwords are stored hashed, so we can't retrieve it for you - return 0 + # passwords are stored hashed, so we send the hash and let the user choose a new password + return 1 } ad_proc -private auth::local::password::CanResetPassword { @@ -324,9 +324,21 @@ Implements the RetrievePassword operation of the auth_password service contract for the local account implementation. } { - set result(password_status) "not_supported" - set result(password_message) [_ acs-subsite.cannot_retrieve_password] + set result(password_status) "ok" + set result(password_message) [_ acs-subsite.Request_Change_Password_token_email] + db_1row get_usr_id_and_password_hash {SELECT user_id, password as password_hash FROM users WHERE username = :username} + + # TODO: This email message text should go in the recipient user language, english or every language supported + set subject "[ad_system_name]: [_ acs-subsite.change_password_email_subject] $username" + set body "[_ acs-subsite.change_password_email_body_0]\n\n[export_vars -base "[ad_url]/user/password-reset" {user_id password_hash}]\n\n[_ acs-subsite.change_password_email_body_1]" + + ns_sendmail \ + $username \ + [ad_outgoing_sender] \ + $subject \ + $body + return [array get result] }