projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
voip: rearrange and compact call details on invoices, so place names get cut off...
[freeside.git]
/
FS
/
FS
/
svc_acct.pm
diff --git
a/FS/FS/svc_acct.pm
b/FS/FS/svc_acct.pm
index
58442c9
..
35596e3
100644
(file)
--- a/
FS/FS/svc_acct.pm
+++ b/
FS/FS/svc_acct.pm
@@
-7,6
+7,7
@@
use vars qw( @ISA $DEBUG $me $conf
$username_ampersand $username_letter $username_letterfirst
$username_noperiod $username_nounderscore $username_nodash
$username_uppercase
$username_ampersand $username_letter $username_letterfirst
$username_noperiod $username_nounderscore $username_nodash
$username_uppercase
+ $password_noampersand $password_noexclamation
$welcome_template $welcome_from $welcome_subject $welcome_mimetype
$smtpmachine
$radius_password $radius_ip
$welcome_template $welcome_from $welcome_subject $welcome_mimetype
$smtpmachine
$radius_password $radius_ip
@@
-55,6
+56,8
@@
$FS::UID::callback{'FS::svc_acct'} = sub {
$username_nodash = $conf->exists('username-nodash');
$username_uppercase = $conf->exists('username-uppercase');
$username_ampersand = $conf->exists('username-ampersand');
$username_nodash = $conf->exists('username-nodash');
$username_uppercase = $conf->exists('username-uppercase');
$username_ampersand = $conf->exists('username-ampersand');
+ $password_noampersand = $conf->exists('password-noexclamation');
+ $password_noexclamation = $conf->exists('password-noexclamation');
$dirhash = $conf->config('dirhash') || 0;
if ( $conf->exists('welcome_email') ) {
$welcome_template = new Text::Template (
$dirhash = $conf->config('dirhash') || 0;
if ( $conf->exists('welcome_email') ) {
$welcome_template = new Text::Template (
@@
-683,6
+686,12
@@
sub check {
unless ( $username_ampersand ) {
$recref->{username} =~ /\&/ and return gettext('illegal_username');
}
unless ( $username_ampersand ) {
$recref->{username} =~ /\&/ and return gettext('illegal_username');
}
+ if ( $password_noampersand ) {
+ $recref->{_password} =~ /\&/ and return gettext('illegal_password');
+ }
+ if ( $password_noexclamation ) {
+ $recref->{_password} =~ /\!/ and return gettext('illegal_password');
+ }
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
@@
-702,9
+711,7
@@
sub check {
return "Only root can have uid 0"
if $recref->{uid} == 0
return "Only root can have uid 0"
if $recref->{uid} == 0
- && $recref->{username} ne 'root'
- && $recref->{username} ne 'toor';
-
+ && $recref->{username} !~ /^(root|toor|smtp)$/;
$recref->{dir} =~ /^([\/\w\-\.\&]*)$/
or return "Illegal directory: ". $recref->{dir};
$recref->{dir} =~ /^([\/\w\-\.\&]*)$/
or return "Illegal directory: ". $recref->{dir};
@@
-855,20
+862,19
@@
sub _check_duplicate {
or die dbh->errstr;
warn "$me acquired svc_acct table lock for duplicate search" if $DEBUG;
or die dbh->errstr;
warn "$me acquired svc_acct table lock for duplicate search" if $DEBUG;
- my $svcpart = $self->svcpart;
- my $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
+ my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
unless ( $part_svc ) {
return 'unknown svcpart '. $self->svcpart;
}
my $global_unique = $conf->config('global_unique-username');
unless ( $part_svc ) {
return 'unknown svcpart '. $self->svcpart;
}
my $global_unique = $conf->config('global_unique-username');
- my @dup_user = grep {
$svcpart != $_->svcpart
}
+ my @dup_user = grep {
!$self->svcnum || $_->svcnum != $self->svcnum
}
qsearch( 'svc_acct', { 'username' => $self->username } );
return gettext('username_in_use')
if $global_unique eq 'username' && @dup_user;
qsearch( 'svc_acct', { 'username' => $self->username } );
return gettext('username_in_use')
if $global_unique eq 'username' && @dup_user;
- my @dup_userdomain = grep {
$svcpart != $_->svcpart
}
+ my @dup_userdomain = grep {
!$self->svcnum || $_->svcnum != $self->svcnum
}
qsearch( 'svc_acct', { 'username' => $self->username,
'domsvc' => $self->domsvc } );
return gettext('username_in_use')
qsearch( 'svc_acct', { 'username' => $self->username,
'domsvc' => $self->domsvc } );
return gettext('username_in_use')
@@
-877,7
+883,7
@@
sub _check_duplicate {
my @dup_uid;
if ( $part_svc->part_svc_column('uid')->columnflag ne 'F'
&& $self->username !~ /^(toor|(hyla)?fax)$/ ) {
my @dup_uid;
if ( $part_svc->part_svc_column('uid')->columnflag ne 'F'
&& $self->username !~ /^(toor|(hyla)?fax)$/ ) {
- @dup_uid = grep {
$svcpart != $_->svcpart
}
+ @dup_uid = grep {
!$self->svcnum || $_->svcnum != $self->svcnum
}
qsearch( 'svc_acct', { 'uid' => $self->uid } );
} else {
@dup_uid = ();
qsearch( 'svc_acct', { 'uid' => $self->uid } );
} else {
@dup_uid = ();
@@
-938,8
+944,8
@@
sub _check_duplicate {
my $dup_svcpart = $dup_uid->cust_svc->svcpart;
if ( exists($conflict_user_svcpart{$dup_svcpart})
|| exists($conflict_userdomain_svcpart{$dup_svcpart}) ) {
my $dup_svcpart = $dup_uid->cust_svc->svcpart;
if ( exists($conflict_user_svcpart{$dup_svcpart})
|| exists($conflict_userdomain_svcpart{$dup_svcpart}) ) {
- return "duplicate uid: conflicts with svcnum". $dup_uid->svcnum.
- "via exportnum ". $conflict_user_svcpart{$dup_svcpart}
+ return "duplicate uid: conflicts with svcnum
". $dup_uid->svcnum.
+ "
via exportnum ". $conflict_user_svcpart{$dup_svcpart}
|| $conflict_userdomain_svcpart{$dup_svcpart};
}
}
|| $conflict_userdomain_svcpart{$dup_svcpart};
}
}
@@
-1021,7
+1027,7
@@
Returns the domain associated with this account.
sub domain {
my $self = shift;
die "svc_acct.domsvc is null for svcnum ". $self->svcnum unless $self->domsvc;
sub domain {
my $self = shift;
die "svc_acct.domsvc is null for svcnum ". $self->svcnum unless $self->domsvc;
- my $svc_domain = $self->svc_domain
+ my $svc_domain = $self->svc_domain
(@_)
or die "no svc_domain.svcnum for svc_acct.domsvc ". $self->domsvc;
$svc_domain->domain;
}
or die "no svc_domain.svcnum for svc_acct.domsvc ". $self->domsvc;
$svc_domain->domain;
}
@@
-1059,7
+1065,7
@@
Returns an email address associated with the account.
sub email {
my $self = shift;
sub email {
my $self = shift;
- $self->username. '@'. $self->domain;
+ $self->username. '@'. $self->domain
(@_)
;
}
=item acct_snarf
}
=item acct_snarf
@@
-1136,16
+1142,16
@@
sub attribute_since_sqlradacct {
$self->cust_svc->attribute_since_sqlradacct(@_);
}
$self->cust_svc->attribute_since_sqlradacct(@_);
}
-=item get_session_history
_sqlradacct
TIMESTAMP_START TIMESTAMP_END
+=item get_session_history TIMESTAMP_START TIMESTAMP_END
Returns an array of hash references of this customers login history for the
given time range. (document this better)
=cut
Returns an array of hash references of this customers login history for the
given time range. (document this better)
=cut
-sub get_session_history
_sqlradacct
{
+sub get_session_history {
my $self = shift;
my $self = shift;
- $self->cust_svc->get_session_history
_sqlradacct
(@_);
+ $self->cust_svc->get_session_history(@_);
}
=item radius_groups
}
=item radius_groups
@@
-1408,7
+1414,7
@@
sub radius_usergroup_selector {
END
foreach my $group ( @all_groups ) {
END
foreach my $group ( @all_groups ) {
- $html .=
'<OPTION'
;
+ $html .=
qq(<OPTION VALUE="$group")
;
if ( $sel_groups{$group} ) {
$html .= ' SELECTED';
$sel_groups{$group} = 0;
if ( $sel_groups{$group} ) {
$html .= ' SELECTED';
$sel_groups{$group} = 0;
@@
-1416,7
+1422,7
@@
END
$html .= ">$group</OPTION>\n";
}
foreach my $group ( grep { $sel_groups{$_} } keys %sel_groups ) {
$html .= ">$group</OPTION>\n";
}
foreach my $group ( grep { $sel_groups{$_} } keys %sel_groups ) {
- $html .=
"<OPTION SELECTED>$group</OPTION>\n"
;
+ $html .=
qq(<OPTION VALUE="$group" SELECTED>$group</OPTION>\n)
;
};
$html .= '</SELECT>';
};
$html .= '</SELECT>';