auth::local::password::ChangePassword (private)

 auth::local::password::ChangePassword username new_password \
    [ old_password ] [ parameters ] [ authority_id ]

Defined in packages/acs-authentication/tcl/local-procs.tcl

Implements the ChangePassword operation of the auth_password service contract for the local account implementation.

Parameters:
username (required)
new_password (required)
old_password (optional)
parameters (optional)
authority_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_password_implementations auth_password_implementations (test acs-authentication) auth::local::password::ChangePassword auth::local::password::ChangePassword test_auth_password_implementations->auth::local::password::ChangePassword _ _ (public) auth::local::password::ChangePassword->_ acs_mail_lite::send acs_mail_lite::send (public) auth::local::password::ChangePassword->acs_mail_lite::send acs_user::get_by_username acs_user::get_by_username (public) auth::local::password::ChangePassword->acs_user::get_by_username acs_user::get_user_info acs_user::get_user_info (public) auth::local::password::ChangePassword->acs_user::get_user_info ad_acs_kernel_id ad_acs_kernel_id (public) auth::local::password::ChangePassword->ad_acs_kernel_id AcsSc.auth_password.changepassword.local AcsSc.auth_password.changepassword.local (private) AcsSc.auth_password.changepassword.local->auth::local::password::ChangePassword auth::local::password::register_impl auth::local::password::register_impl (private) auth::local::password::register_impl->auth::local::password::ChangePassword

Testcases:
auth_password_implementations
Source code:
    array set result {
        password_status {}
        password_message {}
    }

    set user_id [acs_user::get_by_username -authority_id $authority_id -username $username]
    if { $user_id eq "" } {
        set result(password_status) "no_account"
        return [array get result]
    }

    if { $old_password ne "" } {
        if { ![ad_check_password $user_id $old_password] } {
            set result(password_status) "old_password_bad"
            return [array get result]
        }
    }

    ad_try {
        ad_change_password $user_id $new_password
    } on error {errorMsg} {
        set result(password_status) "change_error"
        ad_log Error "Error changing local password for username $username, user_id $user_id: $errorMsg"
        return [array get result]
    }

    set result(password_status) "ok"

    if { [parameter::get -parameter EmailAccountOwnerOnPasswordChangeP -package_id [ad_acs_kernel_id] -default 1] } {
        ad_try {
            set user_id [acs_user::get_by_username  -username $username  -authority_id $authority_id]
            set user_email [party::get -party_id $user_id -element email]

            set system_name [ad_system_name]
            set pvt_home_name [ad_pvt_home_name]
            set password_update_link_text [_ acs-subsite.Change_my_Password]

            if { [auth::UseEmailForLoginP] } {
                set account_id_label [_ acs-subsite.Email]
                set account_id $user_email
            } else {
                set account_id_label [_ acs-subsite.Username]
                set account_id [acs_user::get_user_info  -user_id $user_id  -element username]
            }

            set subject [_ acs-subsite.Password_changed_subject]
            set body [_ acs-subsite.Password_changed_body]

            acs_mail_lite::send  -send_immediately  -to_addr $user_email  -from_addr [ad_outgoing_sender]  -subject $subject  -body $body
        } on error {errorMsg} {
            ad_log Error "Error sending out password changed notification to account owner with user_id $user_id, email $user_email: $errorMsg"
        }
    }

    return [array get result]
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-authentication/tcl/local-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: