danw
committed
on 10 Oct 02
changes to make search work with openfts 0.3
openacs-4/.../tcl/password-procs.tcl (+3 -3)
133 133                     failed_to_connect {Error communicating with authentication server}
134 134                 }
135 135                 set result(password_message) $default_message($result(password_status))
136 136             }
137 137         }
138 138         default {
139 139             set result(password_status) "failed_to_connect"
140 140             set result(password_message) "Illegal code returned from password management driver"
141 141             ad_log Error "Error invoking password management driver for authority_id = $user(authority_id): Illegal return code from driver: $result(password_status)"
142 142         }
143 143     }
144 144
145 145     return [array get result]
146 146 }
147 147
148 148 ad_proc -public auth::password::recover_password {
149 149     {-authority_id ""}
150 150     {-username ""}
151 151     {-email ""}
152 152 } {
153       Handles forgotten passwords.  Attempts to retrieve a password; if not possibe,
  153     Handles forgotten passwords.  Attempts to retrieve a password; if not possible,
154 154     attempts to reset a password.  If it succeeds, it emails the user.  For all
155 155     outcomes, it returns a message to be displayed.
156 156
157 157     @param authority_id The ID of the authority that the user is trying to log into.
158 158     @param username     The username that the user's trying to log in with.
159 159     @param email        Email can be supplied instead of authority_id and username.
160 160
161 161     @return Array list with the following entries:
162 162
163 163     <ul>
164 164         <li> password_status: ok, no_support, failed_to_connect
165 165         <li> password_message: Human-readable message to be relayed to the user. May contain HTML.
166 166     </ul>
167 167 } {
168 168     if { $username eq "" } {
169 169         if { $email eq "" } {
170 170             set result(password_status) "failed_to_connect"
171 171             if { [auth::UseEmailForLoginP] } {
172 172                 set result(password_message) "Email required"
173 173             } else {
 
262 262         if { $forgotten_pwd_url ne "" } {
263 263             regsub -all "{username}" $forgotten_pwd_url $username forgotten_pwd_url
264 264         } elseif { !$remote_only_p } {
265 265             if { [auth::password::can_retrieve_p -authority_id $authority_id] || [auth::password::can_reset_p -authority_id $authority_id] } {
266 266                 set forgotten_pwd_url $local_url
267 267             }
268 268         }
269 269     } else {
270 270         # We don't have the username
271 271         if { !$remote_only_p } {
272 272             set forgotten_pwd_url "[subsite::get_element -element url]register/recover-password"
273 273         }
274 274     }
275 275
276 276     return $forgotten_pwd_url
277 277 }
278 278
279 279 ad_proc -public auth::password::can_retrieve_p {
280 280     {-authority_id:required}
281 281 } {
282       Returns whether the given authority can retrive forgotten passwords.
  282     Returns whether the given authority can retrieve forgotten passwords.
283 283
284 284     @param authority_id The ID of the authority that the user is trying to log into.
285 285
286 286     @return 1 if the authority allows retrieving passwords, 0 otherwise.
287 287 } {
288 288     set result_p 0
289 289     ad_try {
290 290         set result_p [auth::password::CanRetrievePassword \
291 291                     -authority_id $authority_id]
292 292     } on error {errorMsg} {
293 293         ad_log Error "Error invoking CanRetrievePassword operation for authority_id $authority_id: $errorMsg"
294 294         return 0
295 295     }
296 296     return $result_p
297 297 }
298 298
299 299 ad_proc -public auth::password::retrieve {
300 300     {-authority_id:required}
301 301     {-username:required}
302 302 } {