summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-02-01 11:13:39 +0000
committerivan <ivan>2011-02-01 11:13:39 +0000
commit54fd27780c3b48eb1a05be892f65f26b0daab197 (patch)
treea65cc044869c2e948de80f9fe1194efd7da46f40
parent90f61f8a55ceb6fb122c2dde4d6a1aab6976b909 (diff)
add username-pound config
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/svc_acct.pm11
2 files changed, 15 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 41c7e0578..11d237e1d 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4285,6 +4285,13 @@ and customer address. Include units.',
'select_enum' => [ 'Classic', 'Recurring' ],
},
+ {
+ 'key' => 'username-pound',
+ 'section' => 'username',
+ 'description' => 'Allow the pound character (#) in usernames.',
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 528c30b52..0525b979d 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -9,7 +9,7 @@ use vars qw( $DEBUG $me $conf $skip_fuzzyfiles
$username_ampersand $username_letter $username_letterfirst
$username_noperiod $username_nounderscore $username_nodash
$username_uppercase $username_percent $username_colon
- $username_slash $username_equals
+ $username_slash $username_equals $username_pound
$password_noampersand $password_noexclamation
$warning_template $warning_from $warning_subject $warning_mimetype
$warning_cc
@@ -77,6 +77,7 @@ FS::UID->install_callback( sub {
$username_colon = $conf->exists('username-colon');
$username_slash = $conf->exists('username-slash');
$username_equals = $conf->exists('username-equals');
+ $username_pound = $conf->exists('username-pound');
$password_noampersand = $conf->exists('password-noexclamation');
$password_noexclamation = $conf->exists('password-noexclamation');
$dirhash = $conf->config('dirhash') || 0;
@@ -1247,7 +1248,7 @@ sub check {
my $ulen = $usernamemax || $self->dbdef_table->column('username')->length;
- $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:\/\=]{$usernamemin,$ulen})$/i
+ $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:\/\=\#]{$usernamemin,$ulen})$/i
or return gettext('illegal_username'). " ($usernamemin-$ulen): ". $recref->{username};
$recref->{username} = $1;
@@ -1283,6 +1284,10 @@ sub check {
unless ( $username_equals ) {
$recref->{username} =~ /\=/ and return gettext('illegal_username');
}
+ unless ( $username_pound ) {
+ $recref->{username} =~ /\#/ and return gettext('illegal_username');
+ }
+
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
@@ -1326,7 +1331,7 @@ sub check {
unless ( $part_svc->part_svc_column('dir')->columnflag eq 'F' ) {
- $recref->{dir} =~ /^([\/\w\-\.\&\:]*)$/
+ $recref->{dir} =~ /^([\/\w\-\.\&\:\#]*)$/
or return "Illegal directory: ". $recref->{dir};
$recref->{dir} = $1;
return "Illegal directory"