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.114.2.31 -r1.114.2.32 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 17 Jul 2024 13:56:43 -0000 1.114.2.31 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 28 Aug 2024 10:06:11 -0000 1.114.2.32 @@ -126,7 +126,11 @@ if { [string is false [parameter::get_from_package_key \ -package_key acs-authentication \ -parameter AllowSelfRegister]] } { - util_user_message -message "Self registration is not allowed" + if {[ad_conn session_id] ne ""} { + util_user_message -message "Self registration is not allowed" + } else { + ns_log notice "auth::self_registration: cannot set user_message 'Self registration is not allowed'" + } auth::require_login } } Index: openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl,v diff -u -r1.53.2.22 -r1.53.2.23 --- openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 17 Jul 2024 13:56:43 -0000 1.53.2.22 +++ openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 28 Aug 2024 10:06:11 -0000 1.53.2.23 @@ -171,12 +171,14 @@ # Authority bogus array unset auth_info - array set auth_info \ - [auth::authenticate \ - -no_cookie \ - -authority_id -123 \ - -username $username \ - -password $password] + aa_silence_log_entries -severities error { + array set auth_info \ + [auth::authenticate \ + -no_cookie \ + -authority_id -123 \ + -username $username \ + -password $password] + } aa_equals "auth_status for bad authority_id authentication" $auth_info(auth_status) "failed_to_connect" aa_true "auth_message for bad authority_id authentication" {$auth_info(auth_message) ne ""} @@ -562,16 +564,21 @@ -test_code { aa_log [list auth::password::recover_password \ -authority_id $test_vars(authority_id) \ - -username $test_vars(username)] - array set password_result [auth::password::recover_password \ - -authority_id $test_vars(authority_id) \ - -username $test_vars(username)] + -username $test_vars(username)] + aa_silence_log_entries -severities error { + # + # Handle case without errors, when mail is not configred. + # + array set password_result [auth::password::recover_password \ + -authority_id $test_vars(authority_id) \ + -username $test_vars(username)] + } if {[::acs_mail_lite::configured_p]} { aa_equals "status ok" $password_result(password_status) "ok" } else { - aa_equals "SMTP host not configured" $password_result(password_status) "failed_to_connect" + aa_equals "SMTP host not configured" $password_result(password_status) "failed_to_connect" } - + aa_true "nonempty message" {$password_result(password_message) ne ""} } } @@ -616,13 +623,19 @@ Test the auth::password::retrieve proc. } { auth::test::get_password_vars -array_name test_vars - array set result [auth::password::retrieve \ - -authority_id $test_vars(authority_id) \ - -username $test_vars(username)] + + aa_silence_log_entries -severities error { + # + # Handle case without errors, when mail is not configred. + # + array set result [auth::password::retrieve \ + -authority_id $test_vars(authority_id) \ + -username $test_vars(username)] + } if {[::acs_mail_lite::configured_p]} { aa_equals "retrieve pwd from local auth" $result(password_status) "ok" } else { - aa_equals "SMTP host not configured" $result(password_status) "failed_to_connect" + aa_equals "SMTP host not configured" $result(password_status) "failed_to_connect" } aa_true "must have message on failure" {$result(password_message) ne ""} Index: openacs-4/packages/acs-authentication/tcl/test/authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/authentication-procs.tcl,v diff -u -r1.1.2.17 -r1.1.2.18 --- openacs-4/packages/acs-authentication/tcl/test/authentication-procs.tcl 11 Oct 2023 16:58:20 -0000 1.1.2.17 +++ openacs-4/packages/acs-authentication/tcl/test/authentication-procs.tcl 28 Aug 2024 10:06:11 -0000 1.1.2.18 @@ -211,8 +211,10 @@ -parameter RegisterAuthority \ -package_key "acs-authentication" \ -value $not_exists - aa_equals "Non existent register authority '$not_exists' falls back to the local authority" \ - [auth::authority::local] [auth::get_register_authority] + aa_silence_log_entries -severities error { + aa_equals "Non existent register authority '$not_exists' falls back to the local authority" \ + [auth::authority::local] [auth::get_register_authority] + } # # Put the auhtority back as it was to not pollute @@ -407,7 +409,11 @@ if {$auth_level ne ""} { ad_conn -set auth_level $auth_level } - ns_return 200 text/plain [auth::refresh_login] + ad_unless_script_abort { + set user_id [auth::refresh_login] + } { + ns_return 200 text/plain $user_id + } } set result [acs::test::user::create] @@ -443,7 +449,11 @@ try { set endpoint_name test__auth__self_registration ns_register_proc GET $endpoint_name { - ns_return 200 text/plain [auth::self_registration] + ad_unless_script_abort { + set user_id [auth::self_registration] + } { + ns_return 200 text/plain $user_id + } } set result [acs::test::user::create] Index: openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl,v diff -u -r1.28.2.12 -r1.28.2.13 --- openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 17 Jul 2024 13:55:09 -0000 1.28.2.12 +++ openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 28 Aug 2024 10:06:11 -0000 1.28.2.13 @@ -1235,15 +1235,16 @@ $doc aa_log "One invalid operation" - aa_true "With invalid operations, call returns an error" [catch { # This is in fact the call that will fail, because # of a check constraint on the 'operation' column. - auth::sync::job::create_entry \ - -job_id $job_id \ - -operation broken \ - -username [dict get $user username] \ - -success + aa_silence_log_entries -serverities error { + auth::sync::job::create_entry \ + -job_id $job_id \ + -operation broken \ + -username [dict get $user username] \ + -success + } # If the check was not there in the database, this # call would also fail, as the check is @@ -1254,7 +1255,6 @@ -operation GetAcknowledgementDocument \ -call_args [list $job_id $doc [list]] }] - } aa_section auth::sync::process_doc::ims::ProcessDocument