X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcontact.pm;h=44c538806f1f1d0357de6da76fd2c96fe72f8758;hp=fd3e9d770dd8a4ac171fdf5784d7f5062b27f091;hb=ac6ee60516873a1c79d5d4c72269705b29dbdeca;hpb=1aecd5bf33146bf3f374341a3814960ae1d419e8 diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index fd3e9d770..44c538806 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -10,6 +10,7 @@ use FS::Record qw( qsearch qsearchs dbh ); use FS::Cursor; use FS::contact_phone; use FS::contact_email; +use FS::contact::Import; use FS::queue; use FS::phone_type; #for cgi_contact_fields use FS::cust_contact; @@ -577,6 +578,15 @@ sub replace { } } + if ( $self->get('password') ) { + my $error = $self->is_password_allowed($self->get('password')) + || $self->change_password($self->get('password')); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -663,7 +673,7 @@ and replace methods. sub check { my $self = shift; - if ( $self->selfservice_access eq 'R' ) { + if ( $self->selfservice_access eq 'R' || $self->selfservice_access eq 'P' ) { $self->selfservice_access('Y'); $self->_resend('Y'); } @@ -766,8 +776,13 @@ sub by_selfservice_email { 'table' => 'contact_email', 'addl_from' => ' LEFT JOIN contact USING ( contactnum ) ', 'hashref' => { 'emailaddress' => $email, }, - 'extra_sql' => " AND ( contact.disabled IS NULL ) ". - " AND ( contact.selfservice_access = 'Y' )", + 'extra_sql' => " + AND ( contact.disabled IS NULL ) + AND EXISTS ( SELECT 1 FROM cust_contact + WHERE contact.contactnum = cust_contact.contactnum + AND cust_contact.selfservice_access = 'Y' + ) + ", }) or return ''; $contact_email->contact; @@ -867,7 +882,10 @@ sub send_reset_email { 'svcnum' => $opt{'svcnum'}, }; - my $timeout = '24 hours'; #? + + my $conf = new FS::Conf; + my $timeout = + ($conf->config('selfservice-password_reset_hours') || 24 ). ' hours'; my $reset_session_id; do { @@ -879,8 +897,6 @@ sub send_reset_email { #email it - my $conf = new FS::Conf; - my $cust_main = ''; my @cust_contact = grep $_->selfservice_access, $self->cust_contact; $cust_main = $cust_contact[0]->cust_main if scalar(@cust_contact) == 1; @@ -939,7 +955,7 @@ sub cgi_contact_fields { my @contact_fields = qw( classnum first last title comment emailaddress selfservice_access - invoice_dest + invoice_dest password ); push @contact_fields, 'phonetypenum'. $_->phonetypenum