FS::svc_Radius_Mixin
FS::svc_Tower_Mixin
FS::svc_IP_Mixin
- FS::svc_Common );
+ FS::Password_Mixin
+ FS::svc_Common
+ );
+
+use strict;
use vars qw( $DEBUG $me $conf $skip_fuzzyfiles
$dir_prefix @shells $usernamemin
$usernamemax $passwordmin $passwordmax
use FS::cdr;
use FS::acct_snarf;
use FS::tower_sector;
-use FS::Misc;
$DEBUG = 0;
$me = '[FS::svc_acct]';
disable_inventory => 1,
},
'_password' => { label => 'Password',
- required => 1
+ #required => 1
},
'gid' => {
label => 'GID',
'child_objects' => $self->child_objects,
%options,
);
+
+ $error ||= $self->insert_password_history;
+
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
$cust_main->invoicing_list(\@invoicing_list);
}
- #welcome email/letter
+ #welcome email
my @welcome_exclude_svcparts = $conf->config('svc_acct_welcome_exclude');
unless ( grep { $_ eq $self->svcpart } @welcome_exclude_svcparts ) {
- #indent skips a level for some reason
- #welcome email
my $error = '';
my $msgnum = $conf->config('welcome_msgnum', $agentnum);
if ( $msgnum ) {
} # if $welcome_template
} # if !$msgnum
- # print welcome letter
- if ($conf->exists('svc_acct_welcome_letter')) {
- my $queue = new FS::queue {
- 'job' => 'FS::svc_acct::process_print_welcome_letter',
- };
- $error = $queue->insert(
- 'svcnum' => $self->svcnum,
- 'template' => 'svc_acct_welcome_letter',
- );
- if ($error) {
- warn "can't send welcome letter: $error";
- }
- }
- #indent skipped a level for some reason
- } # unless in @welcome_exclude_svcparts
+ }
} # if $cust_pkg
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
my $dbh = dbh;
$error = $new->SUPER::replace($old, @_); # usergroup here
+
+ # don't need to record this unless the password was changed
+ if ( $old->_password ne $new->_password ) {
+ $error ||= $new->insert_password_history;
+ }
+
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error if $error;
$self->domain. '/maildirs/'. $self->username. '/';
}
+=item password_svc_check
+
+Override, for L<FS::Password_Mixin>. Not really intended for other use.
+
+=cut
+
+sub password_svc_check {
+ my ($self, $password) = @_;
+ foreach my $field ( qw(username finger) ) {
+ foreach my $word (split(/\W+/,$self->get($field))) {
+ next unless length($word) > 2;
+ if ($password =~ /$word/i) {
+ return qq(Password contains account information '$word');
+ }
+ }
+ }
+ return '';
+}
+
=back
=head1 CLASS METHODS
}
}
-sub process_print_welcome_letter {
- my %opt = @_;
-
- my $self = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } )
- or die "invalid svc_acct: " . $opt{'svcnum'};
- my $cust_main = $self->cust_svc->cust_pkg->cust_main;
-
- my $ps = $cust_main->print_ps('svc_acct_welcome_letter',
- 'extra_fields' => {
- map { $_ => $self->$_ } $self->fields, # or maybe just username & password?
- },
- );
- my $error = FS::Misc::do_print(
- [ $ps ],
- 'agentnum' => $cust_main->agentnum,
- );
- die $error if $error;
-
-}
-
=back
=head1 BUGS