diff options
author | ivan <ivan> | 2009-04-07 18:20:43 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-04-07 18:20:43 +0000 |
commit | 84cb979c86a35805cfc6c4530ad4505243b7cfd0 (patch) | |
tree | 19fd19ef2672772dab7ed68e19612398137a3dbf /FS | |
parent | 6ec8ff467b97a07dcf353631809d69485fb9958a (diff) |
add a config to allow colon in usernames, RT#5145
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/svc_acct.pm | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 17da9def9..0c9dd6577 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1195,6 +1195,13 @@ worry that config_items is freeside-specific and icky. 'type' => 'checkbox', }, + { + 'key' => 'username-colon', + 'section' => 'username', + 'description' => 'Allow the colon character (:) in usernames.', + 'type' => 'checkbox', + }, + { 'key' => 'safe-part_bill_event', 'section' => 'UI', diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 9d14b84af..9ab90349f 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -6,7 +6,7 @@ use vars qw( @ISA $DEBUG $me $conf $skip_fuzzyfiles $usernamemax $passwordmin $passwordmax $username_ampersand $username_letter $username_letterfirst $username_noperiod $username_nounderscore $username_nodash - $username_uppercase $username_percent + $username_uppercase $username_percent $username_colon $password_noampersand $password_noexclamation $warning_template $warning_from $warning_subject $warning_mimetype $warning_cc @@ -65,6 +65,7 @@ FS::UID->install_callback( sub { $username_uppercase = $conf->exists('username-uppercase'); $username_ampersand = $conf->exists('username-ampersand'); $username_percent = $conf->exists('username-percent'); + $username_colon = $conf->exists('username-colon'); $password_noampersand = $conf->exists('password-noexclamation'); $password_noexclamation = $conf->exists('password-noexclamation'); $dirhash = $conf->config('dirhash') || 0; @@ -1026,11 +1027,11 @@ sub check { my $ulen = $usernamemax || $self->dbdef_table->column('username')->length; if ( $username_uppercase ) { - $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; } else { - $recref->{username} =~ /^([a-z0-9_\-\.\&\%]{$usernamemin,$ulen})$/ + $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:]{$usernamemin,$ulen})$/ or return gettext('illegal_username'). " ($usernamemin-$ulen): ". $recref->{username}; $recref->{username} = $1; } @@ -1055,6 +1056,9 @@ sub check { unless ( $username_percent ) { $recref->{username} =~ /\%/ and return gettext('illegal_username'); } + unless ( $username_colon ) { + $recref->{username} =~ /\:/ and return gettext('illegal_username'); + } $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum}; $recref->{popnum} = $1; |