X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_acct.pm;h=f935df50d0b6495fb4b04ace610b891db67c74e7;hp=355573b000e03721bf08d3b51994ae0d9476f01c;hb=5a588517044ae46cbfc4e544e9306f0aee8f34c3;hpb=a176034d4fa386de180b893e00bda36b04251778 diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 355573b00..f935df50d 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -245,7 +245,7 @@ sub insert { $self->svcpart($cust_svc->svcpart); } - #new duplicate username checking + #new duplicate username/username@domain/uid checking my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } ); unless ( $part_svc ) { @@ -272,8 +272,7 @@ sub insert { foreach my $part_export ( $part_svc->part_export ) { #this will catch to the same exact export - my @svcparts = map { $_->svcpart } - qsearch('export_svc', { 'exportnum' => $part_export->exportnum }); + my @svcparts = map { $_->svcpart } $part_export->export_svc; #this will catch to exports w/same exporthost+type ??? #my @other_part_export = qsearch('part_export', { @@ -465,7 +464,7 @@ sub delete { if qsearch( 'svc_forward', { 'dstsvc' => $self->svcnum } ); return "Can't delete an account with (svc_www) web service!" - if qsearch( 'svc_www', { 'usersvc' => $self->usersvc } ); + if qsearch( 'svc_www', { 'usersvc' => $self->svcnum } ); # what about records in session ? (they should refer to history table) @@ -1190,6 +1189,39 @@ sub check_password { } +=item crypt_password + +Returns an encrypted password, either by passing through an encrypted password +in the database or by encrypting a plaintext password from the database. + +=cut + +sub crypt_password { + my $self = shift; + #false laziness w/shellcommands.pm + #eventually should check a "password-encoding" field + if ( length($self->_password) == 13 + || $self->_password =~ /^\$(1|2a?)\$/ ) { + $self->_password; + } else { + crypt( + $self->_password, + $saltset[int(rand(64))].$saltset[int(rand(64))] + ); + } +} + +=item virtual_maildir + +Returns $domain/maildirs/$username/ + +=cut + +sub virtual_maildir { + my $self = shift; + $self->domain. '/maildirs/'. $self->username. '/'; +} + =back =head1 SUBROUTINES