adduser: use tab completion lists to catch some more clashes
This commit is contained in:
parent
63b4144799
commit
78d9cd916f
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!perl
|
#!perl
|
||||||
|
|
||||||
|
use List::Util qw(any);
|
||||||
|
|
||||||
HELP1 "adduser <name>" => "Create an account";
|
HELP1 "adduser <name>" => "Create an account";
|
||||||
|
|
||||||
sub command :Tab(adduser) ($self, $cart, $command, @) {
|
sub command :Tab(adduser) ($self, $cart, $command, @) {
|
||||||
|
@ -25,6 +27,13 @@ sub username($self, $cart, $name, @) {
|
||||||
return REJECT, "That name already exists."
|
return REJECT, "That name already exists."
|
||||||
if defined parse_user($name);
|
if defined parse_user($name);
|
||||||
|
|
||||||
|
for my $plugin (RevBank::Plugins->new) {
|
||||||
|
my $id = $plugin->id;
|
||||||
|
|
||||||
|
return REJECT, "That name would clash with the '$id' plugin."
|
||||||
|
if any sub { $_ eq $name }, $plugin->Tab('command');
|
||||||
|
}
|
||||||
|
|
||||||
RevBank::Users::create( $name );
|
RevBank::Users::create( $name );
|
||||||
|
|
||||||
return ACCEPT;
|
return ACCEPT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue