Index: openacs-4/packages/acs-subsite/www/user/password-update-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/Attic/password-update-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/www/user/password-update-2.tcl 15 Apr 2002 22:40:50 -0000 1.3 +++ openacs-4/packages/acs-subsite/www/user/password-update-2.tcl 17 Apr 2002 21:58:15 -0000 1.4 @@ -6,61 +6,39 @@ @cvs-id $Id$ } -query { - password_1 - password_2 + password_1:notnull + password_2:notnull {password_old ""} - {user_id ""} + {user_id:integer ""} {return_url ""} +} -validate { + old_password_match -requires {user_id:integer password_old} { + if {![empty_string_p $user_id] && ![ad_check_password $user_id $password_old]} { + ad_complain "Your current password does not match what you entered in the form." + } + } + confirm_password -requires {password_2:notnull} { + if {[empty_string_p $password_2]} { + ad_complain "You need to confirm the password that you typed. (Type the same thing again.)" + } + } + new_password_match -requires {password_1:notnull password_2:notnull confirm_password} { + if {![string equal $password_1 $password_2]} { + ad_complain "Your passwords don't match! Presumably, you made a typo while entering one of them." + } + } } -properties { return_url:onevalue site_link:onevalue } -set current_user_id [ad_verify_and_get_user_id] - if {[empty_string_p $user_id]} { - set user_id $current_user_id - set admin_enabled_p 0 - ad_require_permission $user_id "write" + set user_id [ad_verify_and_get_user_id] + permission::require_permission -party_id $user_id -object_id $user_id -privilege "write" } else { - set admin_enabled_p 1 - ad_require_permission $user_id "admin" + permission::require_permission -party_id $user_id -object_id $user_id -privilege "admin" } -set bind_vars [ad_tcl_vars_to_ns_set user_id password_1] - -set exception_text "" -set exception_count 0 - -if {!$admin_enabled_p && ![ad_check_password $user_id $password_old] } { - ns_log "Notice" "password matched" - append exception_text "
  • Your current password does not match what you entered in the form\n" - incr exception_count -} - - -if { ![info exists password_1] || [empty_string_p $password_1] } { - append exception_text "
  • You need to type in a password\n" - incr exception_count -} - -if { ![info exists password_2] || [empty_string_p $password_2] } { - append exception_text "
  • You need to confirm the password that you typed. (Type the same thing again.) \n" - incr exception_count -} - - -if { [string compare $password_2 $password_1] != 0 } { - append exception_text "
  • Your passwords don't match! Presumably, you made a typo while entering one of them.\n" - incr exception_count -} - - -if { $exception_count > 0 } { - ad_return_complaint $exception_count $exception_text - return -} - if [empty_string_p $return_url] { set return_url [ad_parameter -package_id [ad_acs_kernel_id] "HomeURL"] set return_link "return to [ad_pvt_home_link]" @@ -69,11 +47,11 @@ } if [catch {ad_change_password $user_id $password_1} errmsg] { - ad_return_error "Ouch!" "Wasn't able to change your password for -unknown reasons. This is probably our fault. Please contact the -system administrator." + ad_return_error "Wasn't able to change your password. Please contact the system administrator." } set site_link [ad_site_home_link] +ad_user_login $user_id + ad_returnredirect $return_url