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.12 -r1.13
--- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 3 Sep 2003 08:59:20 -0000 1.12
+++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 3 Sep 2003 12:37:40 -0000 1.13
@@ -238,7 +238,7 @@
set authority_id [auth::authority::local]
- set create_info [auth::registration::Register \
+ array set create_info [auth::registration::Register \
-authority_id $authority_id \
-username $username \
-password $password \
@@ -249,6 +249,8 @@
-secret_question $secret_question \
-secret_answer $secret_answer]
+ return [array get create_info]
+
# TODO: Check that return codes are correct
# If we ever create remote users, make sure we concatenate any account messages and local account messages
@@ -262,7 +264,7 @@
Get the list of required/optional elements for user registration.
@return Array-list with two entries, both being a subset of
- (username, password, first_names, last_name, email, url, secret_question, secret_answer).
+ (username, password_1, password_2, first_names, last_name, email, url, secret_question, secret_answer).
- required: a list of required elements
@@ -294,40 +296,43 @@
first_names text
last_name text
url text
- password text
+ password_1 text
+ password_2 text
secret_question text
secret_answer text
}
array set widgets {
username text
- email test
+ email text
first_names text
last_name text
url text
- password text
+ password_1 password
+ password_2 password
secret_question text
secret_answer text
}
array set labels [list \
- username [_ acs-subsite.Username] \
- email [_ acs-subsite.Your_email_address] \
- first_names [_ acs-subsite.First_names] \
- last_name [_ acs-subsite.Last_name] \
- url [_ acs-subsite.lt_Personal_Home_Page_UR] \
- password [_ acs-subsite.Your_password] \
- secret_question [_ acs-subsite.Question] \
- secret_answer [_ acs-subsite.Answer] \
- ]
+ username [_ acs-subsite.Username] \
+ email [_ acs-subsite.Your_email_address] \
+ first_names [_ acs-subsite.First_names] \
+ last_name [_ acs-subsite.Last_name] \
+ url [_ acs-subsite.lt_Personal_Home_Page_UR] \
+ password_1 [_ acs-subsite.Your_password] \
+ password_2 [_ acs-subsite.lt_Password_Confirmation] \
+ secret_question [_ acs-subsite.Question] \
+ secret_answer [_ acs-subsite.Answer]]
array set html {
username {size 30}
email {size 30}
first_names {size 20}
last_name {size 25}
url {size 50 value "http://"}
- password {size 20}
+ password_1 {size 20}
+ password_2 {size 20}
secret_question {size 30}
secret_answer {size 30}
}
Index: openacs-4/packages/acs-authentication/tcl/authority-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-authentication/tcl/authority-procs.xql 29 Aug 2003 14:54:00 -0000 1.1
+++ openacs-4/packages/acs-authentication/tcl/authority-procs.xql 3 Sep 2003 12:37:40 -0000 1.2
@@ -4,10 +4,11 @@
- select pretty_name,
- authority_id
- from auth_authorities
- where enabled_p = 't'
+ select pretty_name, authority_id
+ from auth_authorities
+ where enabled_p = 't'
+ and auth_impl_id is not null
+ order by sort_order
Index: openacs-4/packages/acs-authentication/tcl/local-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 29 Aug 2003 12:25:10 -0000 1.7
+++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 3 Sep 2003 12:37:40 -0000 1.8
@@ -349,7 +349,7 @@
set result(optional) { url }
if { ![parameter::get -parameter RegistrationProvidesRandomPasswordP -default 0] } {
- lappend result(required) password
+ lappend result(required) password_1 password_2
}
if { [parameter::get -parameter RequireQuestionForPasswordResetP -default 1] &&
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.12 -r1.13
--- openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 3 Sep 2003 08:59:20 -0000 1.12
+++ openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 3 Sep 2003 12:37:40 -0000 1.13
@@ -117,6 +117,10 @@
@author Peter Marklund
} {
+ # create_user returns ok when trying to create a user
+ # whose email already lives in the db. We should test
+ # against that
+
aa_run_with_teardown \
-rollback \
-test_code {
Index: openacs-4/packages/acs-subsite/www/register/user-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/user-new.adp,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/acs-subsite/www/register/user-new.adp 28 Aug 2003 09:41:42 -0000 1.10
+++ openacs-4/packages/acs-subsite/www/register/user-new.adp 3 Sep 2003 12:37:00 -0000 1.11
@@ -1,77 +1,5 @@
#acs-subsite.Register#
- #acs-subsite.Register#
- usernew.password_confirmation
+ {#acs-subsite.Register#}
-#acs-subsite.lt_Register_as_a_user_of# @system_name@
-
-
-
-
-
+
Index: openacs-4/packages/acs-subsite/www/register/user-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/register/user-new.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/acs-subsite/www/register/user-new.tcl 18 May 2002 20:43:04 -0000 1.6
+++ openacs-4/packages/acs-subsite/www/register/user-new.tcl 3 Sep 2003 12:37:00 -0000 1.7
@@ -1,49 +1,82 @@
ad_page_contract {
+ Page for users to register themselves on the site.
- Registration form for a new user. The password property should be set using
-
ad_set_client_property register
.
+ @cvs-id $Id$
+} -validate {
+ password_1 {
+ if {![string equal $password_1 $password_2]} {
+ ad_complain "[_ acs-subsite.lt_The_passwords_youve_e]"
+ }
+ }
+}
- @cvs-id $Id$
+ad_form -name register -form [auth::get_registration_form_elements] -on_submit {
-} {
- email:notnull
- return_url:optional,nohtml
- { persistent_cookie_p 0 }
-} -properties {
- system_name:onevalue
- export_vars:onevalue
- password:onevalue
- email:onevalue
-}
+ array set creation_info [auth::create_user \
+ -first_names $first_names \
+ -last_name $last_name \
+ -email $email \
+ -url $url \
+ -username $username \
+ -password $password_1 \
+ -secret_question $secret_question \
+ -secret_answer $secret_answer]
-set password [ad_get_client_property register password]
+ # Handle registration problems
-# Check if the email address makes sense.
-# We check it here, because this is the last chance the user has to change it
+ switch $creation_info(creation_status) {
+ ok {
+ # Continue below
+ }
+ default {
+ # Adding the error to just some element, not sure where it makes sense
+ # AFAIK, we can't add errors to the form in general ...
+ ad_form_complain -element first_names -error creation_info(auth_message)
+
+ # Element messages
+ foreach { elm_name elm_error } $creation_info(element_messages) {
+ ad_form_complain -element $elm_name -error $elm_error
+ }
+ continue
+ }
+ }
-if { ![util_email_valid_p $email] } {
- ad_return_complaint 1 "- The email address that you typed doesn't look right to us. Examples of valid email addresses are
-
-- Alice1234@aol.com
-
- joe_smith@hp.com
-
- pierre@inria.fr
-
"
- return
-}
+ switch $creation_info(account_status) {
+ ok {
+ # Continue below
+ }
+ default {
+ error $creation_info(account_message)
+ # Display the message on a separate page
+ set message $creation_info(account_message)
+ ad_return_template "display-message"
+ # TODO: Double-check that this actually causes us to break out of ad_form and have the template display
+ return
+ }
+ }
-# we're going to ask this guy to register
-if { ! [db_0or1row find_person "" ] } {
- set user_id [db_nextval acs_object_id_seq]
- set first_names ""
- set last_name ""
-}
+} -after_submit {
+ # User is registered and logged in
-db_release_unused_handles
+ if { ![exists_and_not_null return_url] } {
+ # Redirect to subsite home page.
+ set return_url [subsite::get_element -element url]
+ }
-set system_name [ad_system_name]
-set export_vars [export_form_vars email return_url user_id]
-set no_require_password_p [ad_parameter RegistrationProvidesRandomPasswordP user-login 0]
-set custom_question_p [ad_parameter UseCustomQuestionForPasswordReset user-login 1]
-set require_question_p [ad_parameter RequireQuestionForPasswordResetP user-login 1]
+ # TODO:
+ # SIMON: Handle creation_message
-ad_return_template
+ # Handle account_message
+ if { ![empty_string_p $creation_info(account_message)] } {
+ set message creation_info(account_message)
+ set continue_url $return_url
+ set continue_label "Continue working with [ad_system_name]"
+ ad_return_template "display-message"
+ return
+ } else {
+ # No messages
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
+}
+