auth::local::registration::Register (private)
auth::local::registration::Register parameters username authority_id \ first_names last_name screen_name email url password \ secret_question secret_answer
Defined in packages/acs-authentication/tcl/local-procs.tcl
Implements the Register operation of the auth_registration service contract for the local account implementation.
- Parameters:
- parameters (required)
- username (required)
- authority_id (required)
- first_names (required)
- last_name (required)
- screen_name (required)
- email (required)
- url (required)
- password (required)
- secret_question (required)
- secret_answer (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- auth_registration_implementations
Source code: array set result { creation_status "ok" creation_message {} element_messages {} account_status "ok" account_message {} generated_pwd_p 0 password {} } # We don't create anything here, so creation always succeeds # And we don't check local account, either set subsite_id [ad_conn subsite_id] # LARS TODO: Move this out of the local driver and into the auth framework # Generate random password? set generated_pwd_p 0 if { $password eq "" || [parameter::get -package_id $subsite_id -parameter RegistrationProvidesRandomPasswordP -default 0] } { set password [ad_generate_random_string] set generated_pwd_p 1 } set result(generated_pwd_p) $generated_pwd_p set result(password) $password # Set user's password set user_id [acs_user::get_by_username -authority_id $authority_id -username $username] ad_change_password $user_id $password # Used in messages below set system_name [ad_system_name] set system_url [ad_url] # LARS TODO: Move this out of the local driver and into the auth framework # Send password confirmation email to user if { [parameter::get -parameter EmailRegistrationConfirmationToUserP -package_id $subsite_id -default 1] } { ad_try { auth::password::email_password -username $username -authority_id $authority_id -password $password -from [parameter::get -parameter NewRegistrationEmailAddress -package_id $subsite_id -default [ad_system_owner]] -subject_msg_key "acs-subsite.email_subject_Registration_password" -body_msg_key "acs-subsite.email_body_Registration_password" } on error {errorMsg} { # We don't fail hard here, just log an error ad_log Error "Error sending registration confirmation to $email: $errorMsg" } } # LARS TODO: Move this out of the local driver and into the auth framework # Notify admin on new registration if { [parameter::get -parameter NotifyAdminOfNewRegistrationsP -package_id $subsite_id -default 0] } { ad_try { set admin_email [parameter::get -parameter NewRegistrationEmailAddress -package_id $subsite_id -default [ad_system_owner]] set admin_id [party::get_by_email -email $admin_email] if { $admin_id eq "" } { set admin_locale [lang::system::site_wide_locale] } else { set admin_locale [lang::user::locale -user_id $admin_id] } set system_url [ad_url] acs_mail_lite::send -send_immediately -to_addr $admin_email -from_addr [ad_outgoing_sender] -subject [lang::message::lookup $admin_locale acs-subsite.lt_New_registration_at_s] -body [lang::message::lookup $admin_locale acs-subsite.lt_first_names_last_name] } on error {errorMsg} { # We don't fail hard here, just log an error ad_log Error "Error sending admin notification to $admin_email: $errorMsg" } } return [array get result]XQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-authentication/tcl/local-procs.xql