Index: openacs-4/packages/acs-subsite/www/register/email-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/email-confirm.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-subsite/www/register/email-confirm.tcl 7 Nov 2002 18:06:57 -0000 1.4 +++ openacs-4/packages/acs-subsite/www/register/email-confirm.tcl 3 Sep 2003 15:05:36 -0000 1.5 @@ -1,58 +1,22 @@ -# /www/register/email-confirm.tcl - ad_page_contract { @cvs-id $Id$ } { row_id:notnull,trim -} -properties { - site_link:onevalue - system_name:onevalue - export_vars:onevalue - user_id:onevalue - email:onevalue - email_verified_p:onevalue - member_state:onevalue + user_id } -# remove whitespace from rowid -# regsub -all "\[ \t\n]+" $rowid {} rowid +set token [auth::get_user_secret_token -user_id $user_id] -# we take authorized here in case the -# person responds more than once - -# we want to catch DB errors related to illegal rowids. -# but, we also have to make sure to get the rturn value from db_0or1row too. -set status [catch {set rowid_check [db_0or1row register_email_user_info_get { - select member_state, email, user_id, email_verified_p - from cc_users - where rowid = :row_id -}]}] - -if { $status != 0 || $rowid_check == 0} { - db_release_unused_handles +if { [string equal $token $row_id] } { ad_return_error "[_ acs-subsite.lt_Couldnt_find_your_rec]" "[_ acs-subsite.lt_Row_id_row_id_is_not_]" return -} - -set site_link [ad_site_home_link] -set system_name [ad_system_name] -set export_vars [export_form_vars email] +} -if {$email_verified_p == "f" && $member_state == "approved"} { - db_dml register_email_user_update "update users - set email_verified_p = 't' - where user_id = :user_id" +auth::confirm_email -user_id $user_id +acs_user::get -user_id $user_id -array user_info -} elseif { $member_state == "needs approval" && $email_verified_p == "f" } { - #state is need_email_verification_and_admin_approv - db_dml register_email_confirm_update3 "update users - set email_verified_p = 't' - where user_id = :user_id" - -} - -set email_verified_p "f" -set member_state "approved" - -ad_return_template +set export_vars [export_form_vars email] +set email $user_info(email) +set site_link [ad_site_home_link] +set system_name [ad_system_name]