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.7 -r1.8 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 28 Aug 2003 14:31:39 -0000 1.7 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 29 Aug 2003 12:25:10 -0000 1.8 @@ -38,13 +38,15 @@ {-authority_id ""} {-username:required} {-password:required} + {-persistent:boolean} } { Try to authenticate and login the user forever by validating the username/password combination, and return authentication and account status codes. @param authority_id The ID of the authority to ask to verify the user. Defaults to local authority. @param username Authority specific username of the user. @param passowrd The password as the user entered it. + @param persistent Set this if you want a permanent login cookie @return Array list with the following entries: @@ -109,7 +111,7 @@ # These are appended to the existing entries in auth_info if { [string equal $auth_info(account_status) "ok"] } { - auth::issue_login -user_id $auth_info(user_id) + auth::issue_login -user_id $auth_info(user_id) -persistent=$persistent_p } } @@ -362,26 +364,34 @@ # Initialize to 'closed', because most cases below mean the account is closed set auth_info(account_status) "closed" + set notification_address [parameter::get -parameter NewRegistrationEmailAddress -default [ad_system_owner]] + # system_name is used in some of the I18N messages set system_name [ad_system_name] switch $member_state { "approved" { if { $email_verified_p == "f" } { - set row_id [db_string rowid_for_email { - select rowid from users where user_id = :user_id - }] + + # Lars TODO: Refactor with code in authentication-procs.tcl + + set row_id [auth::get_user_secret_token -user_id $user_id] # Send email verification email to user - set confirmation_url "[ad_url]/register/email-confirm?[export_vars { row_id }]" + set confirmation_url [export_vars -base "[ad_url]/register/email-confirm" { row_id }] with_catch errmsg { ns_sendmail \ $email \ $notification_address \ "[_ acs-subsite.lt_Welcome_to_system_nam]" \ "[_ acs-subsite.lt_To_confirm_your_regis]" + + set auth_info(account_message) "

[_ acs-subsite.lt_Registration_informat]

[_ acs-subsite.lt_Please_read_and_follo]

" + } { + global errorInfo + ns_log Error "auth::get_local_account: Error sending out email verification email to email $email:\n$errorInfo" + set auth_info(account_message) "We got an error sending out the email for email verification" } - set auth_info(account_message) "

[_ acs-subsite.lt_Registration_informat]

[_ acs-subsite.lt_Please_read_and_follo]

" } else { set auth_info(account_status) "ok" } @@ -405,6 +415,14 @@ return [array get auth_info] } +ad_proc -private auth::get_user_secret_token { + -user_id:required +} { + Get a secret token for the user. Can be used for email verification purposes. +} { + return [db_string select_secret_token {}] +} + ##### # # auth::authentication