Index: openacs-4/packages/acs-subsite/acs-subsite.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/acs-subsite.info,v diff -u -r1.26 -r1.27 --- openacs-4/packages/acs-subsite/acs-subsite.info 19 Mar 2002 00:21:19 -0000 1.26 +++ openacs-4/packages/acs-subsite/acs-subsite.info 14 Apr 2002 04:34:36 -0000 1.27 @@ -546,7 +546,6 @@ - @@ -577,7 +576,6 @@ - @@ -653,6 +651,7 @@ + Index: openacs-4/packages/acs-subsite/www/register/email-for-password-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-for-password-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-for-password-2.tcl 16 Mar 2002 21:08:37 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-for-password-2.tcl 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,11 +1,9 @@ - ad_page_contract { - Check a user's ID -} { + Check the user's ID +} -query { email:notnull } set user_id [cc_lookup_email_user $email] ad_returnredirect "email-password?user_id=$user_id" - Index: openacs-4/packages/acs-subsite/www/register/email-for-password.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-for-password.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-for-password.adp 16 Mar 2002 21:08:37 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-for-password.adp 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,9 +1,14 @@ -Forgotten Password / Enter Your Email +Forgotten Password / Enter Your Email

Forgotten Password - Enter Your Email

-

-

-Your email: -
+
+ +
+ +
+ Your email: +
+ +
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-subsite/www/register/email-for-password.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-subsite/www/register/email-password-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-2.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password-2.adp 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password-2.adp 14 Apr 2002 04:34:36 -0000 1.2 @@ -5,30 +5,34 @@
-Please check your inbox. Within the next few minutes, you should find +Please check your inbox. Within the next few minutes, you should find a message from @system_owner@ containing your password. -

+
- + -Then come back to the login -page and use @system_name@. +

+ + + + + for future reference, please type in a question and an answer to use as + verification. + +

+ + question:
+ answer:
+ + +
+ -
- - - - -for future reference, please type in a question and an answer to use as verification.

-question:
-answer:
- -
+ Then come back to the login page and use + @system_name@.
- - Index: openacs-4/packages/acs-subsite/www/register/email-password-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/register/email-password-2.tcl 9 Sep 2001 14:02:45 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/register/email-password-2.tcl 14 Apr 2002 04:34:36 -0000 1.3 @@ -4,9 +4,10 @@ @author Hiro Iwashima @creation-date 15 Aug 2000 - @cvs-id $ID$ + @version $Id$ } { - user_id:integer + user_id:integer,notnull + {validated_p 0} {answer ""} {first_names ""} {last_name ""} @@ -22,77 +23,62 @@ if {![ad_parameter EmailForgottenPasswordP security 1]} { ad_return_error "Feature disabled" "This feature is disabled on this server." - return + return } -if ![db_0or1row users_state_authorized_or_deleted "select -email from cc_users where user_id=:user_id --- and user_state in ('authorized','deleted')"] { +if {![db_0or1row select_email {}]} { db_release_unused_handles - ad_return_error "Couldn't find user $user_id" "Couldn't find user $user_id. This is probably a bug in our code." + ad_return_error "Couldn't find user $user_id" "Couldn't find user $user_id. This is probably a bug in our code." return } -# Use exists - -set ask_question_p 0 -if [exists_and_not_null answer] { - # There was a question - set value [db_string password_answer "select password_answer from users where user_id = :user_id"] - if {![string compare $value $answer]} { - set validated_p 1 +if {!$validated_p} { + set ask_question_p 0 + if {[exists_and_not_null answer]} { + if {[db_string select_answer_matches_p {}} { + set validated_p 1 + } } else { - set validated_p 0 - } + if {[db_string select_names_match_p {} -default 0]} { + set validated_p 1 + } -} else { - # We check their first and last names - - db_0or1row first_last_name "select first_names db_first_names, last_name db_last_name from cc_users where user_id = $user_id" - - if { [string compare $first_names $db_first_names] || [string compare $last_name $db_last_name] } { - set validated_p 0 - } else { - set validated_p 1 + if {[ad_parameter UseCustomQuestionForPasswordReset security 1]} { + set ask_question_p 1 + } } - - if { [ad_parameter UseCustomQuestionForPasswordReset security 1] } { - - set ask_question_p 1 - - } - } -if { $validated_p != 1 } { +if {!$validated_p} { # Unauthorized Access ad_return_error "Unauthorized Access" "The validation didn't match what we had. Either press back on the browser and retype it in, or go back to the login page." return } +set require_question_p [ad_parameter "RequireQuestionForPasswordResetP"] -#generate a random password +# generate a random password set password [ad_generate_random_string] ad_change_password $user_id $password +set system_owner [ad_system_owner] +set system_name [ad_system_name] + # Send email -if [catch { ns_sendmail $email [ad_system_owner] "Your forgotten password on [ad_system_name]" "Here's how you can log in at [ad_url]: +if [catch {ns_sendmail $email $system_owner "Your forgotten password on $system_name" "Here's how you can log in at [ad_url]: Username: $email Password: $password "} errmsg] { - ad_return_error "Error sending mail" "Now we're really in trouble because we got an error trying to send you email: + ad_return_error "Error sending mail" "Now we're really in trouble because we got an error trying to send you email:
-
-$errmsg
-
+
+    $errmsg
+  
" return } -set system_owner [ad_system_owner] -set system_name [ad_system_name] - ad_return_template Index: openacs-4/packages/acs-subsite/www/register/email-password-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-2.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/register/email-password-2.xql 9 Sep 2001 14:02:45 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/register/email-password-2.xql 14 Apr 2002 04:34:36 -0000 1.3 @@ -1,26 +1,34 @@ - - - select -email from cc_users where user_id=:user_id - - + + + select email + from cc_users + where user_id = :user_id + + - - - - select password_answer from users where user_id = :user_id - - + + + select count(*) + from dual + where exists (select 1 + from users + where user_id = :user_id + and password_answer = :answer) + + - - - - select first_names as db_first_names, last_name as db_last_name from cc_users where user_id = $user_id - - + + + select count(*) + from dual + where exists (select 1 + from persons + where first_names = :first_names + and last_name = :last_name) + + - Index: openacs-4/packages/acs-subsite/www/register/email-password-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-3.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password-3.adp 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password-3.adp 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,10 +1,10 @@ -Customized Question/Answer Entered +Customized Question/Answer Entered -

Wait for our Email

+

Wait for our Email

+
Thank you. When you get your email, go back to the login page and use @system_name@. - Index: openacs-4/packages/acs-subsite/www/register/email-password-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-3.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password-3.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password-3.tcl 14 Apr 2002 04:34:36 -0000 1.2 @@ -16,24 +16,23 @@ email:onevalue } -if ![db_0or1row first_last_names "select first_names db_first_names, last_name db_last_name, password_question from cc_users where user_id = :user_id"] { - - ad_return_error "Couldn't find user $user_id" "Couldn't find user $user_id. This is probably a bug in our code." +if {![db_0or1row select_person_name {}]} { + ad_return_error "Couldn't find user $user_id" "Couldn't find user $user_id. This is probably a bug in our code." return } -if { [string compare $first_names $db_first_names] || [string compare $last_name $db_last_name] } { +if {![string equal -nocase $first_names $db_first_names] && ![string equal -nocase $last_name $db_last_name]} { ad_return_error "Validation Check Failed" "The full name given didn't match. There must be something wrong." return -} +} -if ![empty_string_p $password_question] { +if {![empty_string_p $password_question]} { ad_return_error "Customized question already there" "Customized question is already entered" return } -db_dml update_question "update users set password_question = :question, password_answer = :answer where user_id = :user_id" +db_dml update_question {} set system_name [ad_system_name] -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/acs-subsite/www/register/email-password-3.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password-3.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/register/email-password-3.xql 9 Sep 2001 14:02:45 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/register/email-password-3.xql 14 Apr 2002 04:34:36 -0000 1.3 @@ -1,18 +1,23 @@ - - - select first_names as db_first_names, last_name as db_last_name, password_question from cc_users where user_id = :user_id - - + + + select first_names as db_first_names, + last_name as db_last_name, + password_question + from cc_users + where user_id = :user_id + + - - - - update users set password_question = :question, password_answer = :answer where user_id = :user_id - - + + + update users + set password_question = :question, + password_answer = :answer + where user_id = :user_id + + - Index: openacs-4/packages/acs-subsite/www/register/email-password.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password.adp 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password.adp 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,27 +1,29 @@ -Email Password +Email Password -

Confirmation of Resetting and Emailing New Password

+

Confirmation of Resetting and Emailing New Password

+
-Please verify yourself by providing the information below:
+
-
- +Please verify yourself by providing the information below: - +
-Full Name: + + -
- + + Full Name: + + + @password_question@: + -@password_question@: +
-
-
- +
- - +
Index: openacs-4/packages/acs-subsite/www/register/email-password.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password.tcl 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,28 +1,32 @@ ad_page_contract { Sends the user their password. Depending on the configuration, this password may be a new random password. - @cvs-id $Id$ -} { - user_id:integer + + @version $Id$ +} -query { + user_id:integer,notnull } -properties { user_id:onevalue question_answer_p:onevalue password_question:onevalue } - if {![ad_parameter EmailForgottenPasswordP security 1]} { ad_return_error "Feature disabled" "This feature is disabled on this server." - return + return } -set password_question [db_string question "select password_question from users where user_id = :user_id"] -if { [empty_string_p $password_question] } { - # No question. User their full name +if {![ad_parameter "RequireQuestionForPasswordResetP"]} { + ad_returnredirect "./email-password-2?user_id=$user_id&validated_p=1" + ad_script_abort +} + +set password_question [db_string select_question {} -default ""] + +if {[empty_string_p $password_question]} { set question_answer_p 0 } else { set question_answer_p 1 } ad_return_template - Index: openacs-4/packages/acs-subsite/www/register/email-password.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/Attic/email-password.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/register/email-password.xql 1 May 2001 21:20:18 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/register/email-password.xql 14 Apr 2002 04:34:36 -0000 1.2 @@ -1,11 +1,12 @@ - - - select password_question from users where user_id = :user_id - - + + + select password_question + from users + where user_id = :user_id + + -