X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_user.pm;h=a755daff697f8c286f3759d7879ed122d9b965a6;hb=e3dffa23a03cd9f88946ceb78bc75ada29bc013a;hp=e3a677b11e1689a52512f1a0aa07ce56b3ad3c55;hpb=4b5c6ba830fe2845a0055e1fcf5af0c7e8b8cd0c;p=freeside.git diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index e3a677b11..a755daff6 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -90,6 +90,9 @@ otherwise returns false. sub insert { my $self = shift; + my $error = $self->check; + return $error if $error; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -101,7 +104,7 @@ sub insert { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - my $error = $self->htpasswd_kludge(); + $error = $self->htpasswd_kludge(); if ( $error ) { $dbh->rollback or die $dbh->errstr if $oldAutoCommit; return $error; @@ -111,7 +114,14 @@ sub insert { if ( $error ) { $dbh->rollback or die $dbh->errstr if $oldAutoCommit; + + #make sure it isn't a dup username? or you could nuke people's passwords + #blah. really just should do our own login w/cookies + #and auth out of the db in the first place + #my $hterror = $self->htpasswd_kludge('-D'); + #$error .= " - additionally received error cleaning up htpasswd file: $hterror" return $error; + } else { $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -236,7 +246,7 @@ sub check { my $error = $self->ut_numbern('usernum') - || $self->ut_alpha('username') + || $self->ut_alpha_lower('username') || $self->ut_text('_password') || $self->ut_text('last') || $self->ut_text('first') @@ -319,11 +329,19 @@ Options are passed as a hashref or a list. Available options are: =over 4 -=item null - The frament will also allow the selection of null agentnums. +=item null + +The frament will also allow the selection of null agentnums. + +=item null_right + +The fragment will also allow the selection of null agentnums if the current +user has the provided access right -=item null_right - The fragment will also allow the selection of null agentnums if the current user has the provided access right +=item table -=item table - Optional table name in which agentnum is being checked. Sometimes required to resolve 'column reference "agentnum" is ambiguous' errors. +Optional table name in which agentnum is being checked. Sometimes required to +resolve 'column reference "agentnum" is ambiguous' errors. =back