donb
committed
on 28 Oct 06
Phew talk about obscure. This test case NEVER worked (why do people commit
tests that don't work in the first place????) because it used ad… Show more
Phew talk about obscure.  This test case NEVER worked (why do people commit

tests that don't work in the first place????) because it used ad_library

rather than ad_page_contract to document the template.  ad_library fails

in ad_make_relative_path in this case though I didn't track down why in detail.

Show less

openacs-4/.../tcl/password-procs.tcl (+9 -2)
98 98     acs_user::get -user_id $user_id -array user
99 99
100 100     with_catch errmsg {
101 101         array set result [auth::password::ChangePassword \
102 102                               -authority_id $user(authority_id) \
103 103                               -username $user(username) \
104 104                               -old_password $old_password \
105 105                               -new_password $new_password]
106 106
107 107         # We do this so that if there aren't even a password_status in the array, that gets caught below
108 108         set dummy $result(password_status)
109 109     } {
110 110         set result(password_status) failed_to_connect
111 111         set result(password_message) $errmsg
112 112         global errorInfo
113 113         ns_log Error "Error invoking password management driver for authority_id = $user(authority_id):\n$errorInfo"
114 114     }
115 115    
116 116     # Check the result code and provide canned responses
117 117     switch $result(password_status) {
118           ok {}
  118         ok {
  119             # Invalidate existing login tokens sitting on random other browsers out there
  120             sec_change_user_auth_token $user_id
  121            
  122             # Refresh the current user's cookies, so he doesn't get logged out
  123             ad_user_login -account_status [ad_conn account_status] $user_id
  124            
  125         }
119 126         no_account - not_supported - old_password_bad - new_password_bad - change_error - failed_to_connect {
120 127             if { ![exists_and_not_null result(password_message)] } {
121 128                 array set default_message {
122 129                     no_account {Unknown username}
123 130                     not_supported {This operation is not supported}
124 131                     old_password_bad {Current password incorrect}
125 132                     new_password_bad {New password not accepted}
126 133                     change_error {Error changing password}
127 134                     failed_to_connect {Error communicating with authentication server}
128 135                 }
129 136                 set result(password_message) $default_message($result(password_status))
130 137             }
131 138         }
132 139         default {
133 140             set result(password_status) "failed_to_connect"
134 141             set result(password_message) "Illegal code returned from password management driver"
135 142             ns_log Error "Error invoking password management driver for authority_id = $user(authority_id): Illegal return code from driver: $result(password_status)"
136 143         }
137 144     }
138 145