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.30 -r1.31 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 11 Sep 2003 14:53:34 -0000 1.30 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 12 Sep 2003 13:00:31 -0000 1.31 @@ -244,21 +244,19 @@ {-email ""} {-first_names ""} {-last_name ""} + {-screen_name ""} {-email ""} {-password ""} {-password_confirm ""} {-url ""} {-secret_question ""} {-secret_answer ""} {-email_verified_p ""} - {-member_state "approved"} } { Create a user, and return creation status and account status. @param email_verified_p Whether the local account considers the email to be verified or not. - @param member_state Whether the local account has been approved. - @param verify_password_confirm Set this flag if you want the proc to verify that password and password_confirm match for you. @@ -270,7 +268,7 @@ creation_message or element_messages is guaranteed to be non-empty, and both are guaranteed to be in the array list. May contain HTML.
  • element_messages: list of (element_name, message, element_name, message, ...) of - errors on the individual elements (username, password, first_names, ...), + errors on the individual registration elements. to be relayed on to the user. If creation_status is not ok, then either creation_message or element_messages is guaranteed to be non-empty, and both are guaranteed to be in the array list. Cannot contain HTML. @@ -280,6 +278,8 @@
  • account_message: A human-readable explanation of why the account was closed. May include HTML, and thus shouldn't be quoted. Guaranteed to be non-empty if account_status is not ok. + + @see auth::get_all_registration_elements } { set authority_id [auth::get_register_authority] @@ -324,16 +324,16 @@ # ##### + foreach elm [get_all_registration_elements] { + if { [info exists $elm] } { + set user_info($elm) [set $elm] + } + } array set creation_info [auth::create_local_account \ -user_id $user_id \ -authority_id $authority_id \ -username $username \ - -first_names $first_names \ - -last_name $last_name \ - -email $email \ - -url $url \ - -member_state $member_state \ - -email_verified_p $email_verified_p] + -array user_info] # Returns: # creation_info(creation_status) @@ -378,6 +378,7 @@ -password $password \ -first_names $first_names \ -last_name $last_name \ + -screen_name $screen_name \ -email $email \ -url $url \ -secret_question $secret_question \ @@ -386,7 +387,7 @@ set auth_info(auth_status) failed_to_connect set auth_info(auth_message) $errmsg global errorInfo - ns_log Error "Error invoking account registratino driver for authority_id = $authority_id: $errorInfo" + ns_log Error "Error invoking account registration driver for authority_id = $authority_id: $errorInfo" } @@ -477,14 +478,14 @@ } { 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). + @return Array-list with two entries - + + @see auth::get_all_registration_elements } { set authority_id [auth::get_register_authority] @@ -498,6 +499,7 @@ } # Handle required elements for local account + # TODO: This will depend on a parameter foreach elm { first_names last_name email } { # Add to required if { [lsearch $element_info(required) $elm] == -1 } { @@ -514,6 +516,12 @@ return [array get element_info] } +ad_proc -public auth::get_all_registration_elements {} { + Get the list of possible registration elements. +} { + return { username password first_names last_name screen_name email url secret_question secret_answer } +} + ad_proc -public auth::get_registration_form_elements { {-authority_id ""} } { @@ -526,6 +534,7 @@ email text first_names text last_name text + screen_name text url text password text password_confirm text @@ -538,18 +547,20 @@ email text first_names text last_name text + screen_name text url text password password password_confirm 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] \ + screen_name [_ acs-subsite.Screen_name] \ url [_ acs-subsite.lt_Personal_Home_Page_UR] \ password [_ acs-subsite.Password] \ password_confirm [_ acs-subsite.lt_Password_Confirmation] \ @@ -559,8 +570,9 @@ array set html { username {size 30} email {size 30} - first_names {size 20} - last_name {size 25} + first_names {size 30} + last_name {size 30} + screen_name {size 30} url {size 50 value "http://"} password {size 20} password_confirm {size 20} @@ -587,7 +599,7 @@ } set form_elements [list] - foreach element { username email first_names last_name password password_confirm url secret_question secret_answer } { + foreach element [concat [auth::get_all_registration_elements] password_confirm] { if { [info exists required_p($element)] } { set form_element [list] @@ -619,17 +631,12 @@ {-user_id ""} {-authority_id:required} {-username ""} - {-first_names ""} - {-last_name ""} - {-email ""} - {-url ""} - {-secret_question ""} - {-secret_answer ""} - {-member_state "approved"} - {-email_verified_p ""} + {-array:required} } { Create the local account for a user. + @param array Name of an array containing the registration elements to update. + @return Array list containing the following entries: