user-add-3.tcl

Sends an explicit password setup invitation to a newly added user

Location:
/packages/acs-admin/www/users/user-add-3.tcl
CVS ID:
$Id: user-add-3.tcl,v 1.13 2026/12/04 12:05:58 gustafn Exp $

Related Files

[ hide source ] | [ make this the default ]

File Contents

ad_page_contract {
    Sends an explicit password setup invitation to a newly added user

    @cvs-id $Id: user-add-3.tcl,v 1.13 2026/12/04 12:05:58 gustafn Exp $
} -query {
    user_id:naturalnum,notnull
    send_invitation:boolean,notnull
    {referer:localurl "/acs-admin/users"}
} -validate {
    method { require_post }
    csrf   { csrf::validate }
    invite {
        if {!$send_invitation} {
            ad_complain "Choose Send invitation to send a password setup link."
        }
    }
}

set user [acs_user::get -user_id $user_id]
if {![dict exists $user authority_id]} {
    ns_returnnotfound
    ad_script_abort
}

if {[catch {auth::local::password::send_invitation $user_id} sent]} {
    ns_log Error "Account invitation delivery failed for user $user_id"
    ad_return_error "Mail failed" "The system could not send the invitation."
    ad_script_abort
}
if {!$sent} {
    ad_return_complaint 1 "Password setup invitations require a local account with an email address."
    ad_script_abort
}

set first_names [dict get $user first_names]
set last_name [dict get $user last_name]
set context [list [list "./" "Users"] "Invitation sent"]
set admin_url [acs_community_member_admin_url -user_id $user_id]

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: