X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcontact.pm;h=8f6b6a3b5523bc4892378f7869c7b91cf8d45ad3;hb=e1424fa99483e7d5944dcd729f96ee43f7b6c10d;hp=d906dc9a2e688da9ef656990ce0ba3c517528a9d;hpb=25d96215a7bfd0c4af5323ee658eed7675cf2ee0;p=freeside.git diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index d906dc9a2..8f6b6a3b5 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -12,6 +12,7 @@ use FS::contact_class; use FS::cust_location; use FS::contact_phone; use FS::contact_email; +use FS::contact::Import; use FS::queue; use FS::cust_pkg; use FS::phone_type; #for cgi_contact_fields @@ -130,7 +131,6 @@ sub insert { my $dbh = dbh; my $error = $self->SUPER::insert; - $error ||= $self->insert_password_history; if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -190,6 +190,15 @@ sub insert { } } + 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; ''; @@ -233,7 +242,8 @@ sub delete { } } - my $error = $self->SUPER::delete; + my $error = $self->delete_password_history + || $self->SUPER::delete; if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; @@ -369,6 +379,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; ''; @@ -455,7 +474,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 'E' || $self->selfservice_access eq 'P' ) { $self->selfservice_access('Y'); $self->_resend('Y'); } @@ -603,7 +622,7 @@ sub authenticate_password { $hash eq $check_hash; - } else { + } else { return 0 if $self->_password eq ''; @@ -674,7 +693,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 { @@ -686,8 +708,6 @@ sub send_reset_email { #email it - my $conf = new FS::Conf; - my $cust_main = $self->cust_main or die "no customer"; #reset a password for a prospect contact? someday @@ -740,6 +760,7 @@ sub cgi_contact_fields { my @contact_fields = qw( classnum first last title comment emailaddress selfservice_access + invoice_dest password ); push @contact_fields, 'phonetypenum'. $_->phonetypenum