Index: openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 3 Apr 2006 03:46:22 -0000 1.32 +++ openacs-4/packages/contacts/tcl/contacts-callback-procs.tcl 7 Apr 2006 08:24:40 -0000 1.33 @@ -245,13 +245,16 @@ set value [template::element::get_value $form $element] switch $element { email { - if {[db_0or1row party_is_user_p {select '1' from users where user_id = :party_id}]} { - if {[exists_and_not_null value]} { - set username $value - } else { - set username $party_id + if { [contact::type -party_id $party_id] eq "user" } { + # if the system uses email for username we need to update it + if { [string is true [auth::UseEmailForLoginP]] } { + if {[exists_and_not_null value]} { + set username $value + } else { + set username $party_id + } + acs_user::update -user_id $party_id -username $username } - acs_user::update -user_id $party_id -username $username } party::update -party_id $party_id -email $value -url [db_string get_url {select url from parties where party_id = :party_id} -default {}] }