Index: openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl,v diff -u -r1.79 -r1.80 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 7 Jun 2008 20:28:47 -0000 1.79 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 8 Sep 2008 20:00:10 -0000 1.80 @@ -166,6 +166,8 @@ {-password:required} {-persistent:boolean} {-no_cookie:boolean} + {-first_names ""} + {-last_name ""} } { Try to authenticate and login the user forever by validating the username/password combination, and return authentication and account status codes. @@ -312,8 +314,10 @@ array set result [auth::get_local_account \ -return_url $return_url \ -username $username \ - -authority_id $authority_id] - + -authority_id $authority_id \ + -email $email \ + -first_names $first_names \ + -last_name $last_name] # Returns: # result(account_status) # result(account_message) @@ -1200,6 +1204,9 @@ {-return_url ""} {-username:required} {-authority_id ""} + {-email ""} + {-first_names ""} + {-last_name ""} } { Get the user_id of the local account for the given username and domain combination. @@ -1236,6 +1243,19 @@ if {$info_result(info_status) eq "ok"} { array set user $info_result(user_info) + + if {$email ne "" \ + && (![info exists user(email)] || $user(email) eq "")} { + set user(email) $email + } + if {$first_names ne "" \ + && (![info exists user(first_names)] || $user(first_names) eq "")} { + set user(first_names) $first_names + } + if {$last_name ne "" \ + && (![info exists user(last_name)] || $user(last_name) eq "")} { + set user(last_name) $last_name + } array set creation_info [auth::create_local_account \ -authority_id $authority_id \ -username $username \ @@ -1249,6 +1269,7 @@ auth::authority::get -authority_id $authority_id -array authority set system_name [ad_system_name] set auth_info(account_message) "You have successfully authenticated, but we were unable to create an account for you on $system_name. " + set auth_info(element_messages) $creation_info(element_messages) append auth_info(account_message) "The error was: $creation_info(element_messages). Please contact the system administrator." if { $authority(help_contact_text) ne "" } { Index: openacs-4/packages/acs-kernel/acs-kernel.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v diff -u -r1.97 -r1.98 --- openacs-4/packages/acs-kernel/acs-kernel.info 6 Jul 2008 15:46:15 -0000 1.97 +++ openacs-4/packages/acs-kernel/acs-kernel.info 8 Sep 2008 20:00:09 -0000 1.98 @@ -7,15 +7,15 @@ t t - + OpenACS Core Team Routines and data models providing the foundation for OpenACS-based Web services. 2008-05-31 OpenACS The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, partiies and the supporting PL/SQL and PL/pgSQL procedures. 3 - + Index: openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.5.0d1-5.5.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.5.0d1-5.5.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.5.0d1-5.5.0d2.sql 8 Sep 2008 20:00:10 -0000 1.1 @@ -0,0 +1,7 @@ +alter table auth_authorities add allow_user_entered_info_p; +update auth_authorities set allow_user_entered_info_p 'f'; +alter table auth_authorities add constraint auth_authority_allow_user_i_p_nn (allow_user_entered_email_p) not null; +alter table auth_authorities add constraint auth_authority_allow_user_i_ck + check (allow_user_entered_info_p in ('t','f')) +alter table auth_authorities alter allow_user_entered_info_p set default 'f'; +alter table auth_authorities add search_impl_id integer constraint auth_authorities_search_impl_id_fk references acs_objects(object_id); Index: openacs-4/packages/acs-kernel/sql/postgresql/authentication-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/authentication-create.sql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-kernel/sql/postgresql/authentication-create.sql 25 Sep 2006 17:59:16 -0000 1.14 +++ openacs-4/packages/acs-kernel/sql/postgresql/authentication-create.sql 8 Sep 2008 20:00:09 -0000 1.15 @@ -59,6 +59,12 @@ batch_sync_enabled_p boolean default 'f' constraint auth_authorities_bsenabled_p_nn not null + allow_user_entered_info_p boolean default 'f' + constraint auth_authority_allow_user_i_p_nn + not null, + search_impl_id integer + constraint auth_authorities_search_impl_id_fk + references acs_objects(object_id) ); comment on column auth_authorities.help_contact_text is ' Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.5.0d1-5.5.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.5.0d1-5.5.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.5.0d1-5.5.0d2.sql 8 Sep 2008 20:00:10 -0000 1.1 @@ -0,0 +1,5 @@ +alter table auth_authorities add allow_user_entered_info_p boolean; +update auth_authorities set allow_user_entered_info_p='f'; +alter table auth_authorities alter allow_user_entered_info_p set default 'f'; +alter table auth_authorities add constraint auth_authority_allow_user_i_p_nn (allow_user_entered_email_p) not null; +alter table auth_authorities add search_impl_id integer constraint auth_authorities_search_impl_id_fk references acs_objects(object_id); \ No newline at end of file Index: openacs-4/packages/acs-subsite/lib/login.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/lib/login.tcl,v diff -u -r1.31 -r1.32 --- openacs-4/packages/acs-subsite/lib/login.tcl 7 Sep 2008 04:56:12 -0000 1.31 +++ openacs-4/packages/acs-subsite/lib/login.tcl 8 Sep 2008 20:00:10 -0000 1.32 @@ -197,11 +197,18 @@ if { ![exists_and_not_null persistent_p] } { set persistent_p "f" } + if {![element exists login email]} { + set email [ns_queryget email ""] + } + set first_names [ns_queryget first_names ""] + set last_name [ns_queryget last_name ""] array set auth_info [auth::authenticate \ -return_url $return_url \ -authority_id $authority_id \ -email [string trim $email] \ + -first_names $first_names \ + -last_name $last_name \ -username [string trim $username] \ -password $password \ -persistent=[expr {$allow_persistent_login_p && [template::util::is_true $persistent_p]}]] @@ -232,9 +239,44 @@ # Continue below } default { - # Display the message on a separate page - ad_returnredirect [export_vars -base "[subsite::get_element -element url]register/account-closed" { { message $auth_info(account_message) } }] - ad_script_abort + # if element_messages exists we try to get the element info + if {[info exists auth_info(element_messages)] + && [auth::authority::get_element \ + -authority_id $authority_id \ + -element allow_user_entered_info_p]} { + foreach message [lsort $auth_info(element_messages)] { + ns_log notice "LOGIN $message" + switch -glob -- $message { + *email* { + if {[element exists login email]} { + set operation set_properties + } else { + set operation create + } + element $operation login email -widget $username_widget -datatype text -label [_ acs-subsite.Email] + if {[element error_p login email]} { + template::form::set_error login email [_ acs-subsite.Email_not_provided_by_authority] + } + } + *first* { + element create login first_names -widget text -datatype text -label [_ acs-subsite.First_names] + template::form::set_error login email [_ acs-subsite.First_names_not_provided_by_authority] + } + *last* { + element create login last_name -widget text -datatype text -label [_ acs-subsite.Last_name] + template::form::set_error login last_name [_ acs-subsite.Last_name_not_provided_by_authority] + } + } + } + set auth_info(account_message) "" + + ad_return_template + + } else { + # Display the message on a separate page + ad_returnredirect [export_vars -base "[subsite::get_element -element url]register/account-closed" { { message $auth_info(account_message) } }] + ad_script_abort + } } } } -after_submit { @@ -246,8 +288,10 @@ ad_returnredirect [export_vars -base "[subsite::get_element -element url]register/account-message" { { message $auth_info(account_message) } return_url }] ad_script_abort } else { - # No message - ad_returnredirect $return_url - ad_script_abort - } + if {![info exists auth_info(element_messages)]} { + # No message + ad_returnredirect $return_url + ad_script_abort + } + } }