]> ruin.nu Git - NDIRC.git/commitdiff
Move getpass to Usermgm
authorMichael Andreen <harv@ruin.nu>
Sun, 24 Feb 2019 19:20:00 +0000 (20:20 +0100)
committerMichael Andreen <harv@ruin.nu>
Thu, 21 Mar 2019 15:47:50 +0000 (16:47 +0100)
Commands/Channel.pm
Commands/Usermgm.pm

index 62eae4f9bebd59e6eb353ad7bff927217cfcabdd..2206072bcc1c14af56bcdb882f5b623020eb4c9c 100644 (file)
@@ -114,45 +114,4 @@ command hostname => {
        }
 };
 
        }
 };
 
-command getpass => {
-       help => q(Gives new users a random password.),
-       type => q(pm)
-}, class extends NDIRC::Command {
-
-###########################################################
-# Written by Guy Malachi http://guymal.com
-# 18 August, 2002
-###########################################################
-       sub generate_random_string
-       {
-               my $length_of_randomstring=shift;# the length of
-               # the random string to generate
-
-               my @chars=('a'..'z','A'..'Z','0'..'9','_');
-               my $random_string;
-               foreach (1..$length_of_randomstring)
-               {
-                       # rand @chars will generate a random
-                       # number between 0 and scalar @chars
-                       $random_string .= $chars[rand @chars];
-               }
-               return $random_string;
-       }
-
-       method execute ($c,$msg) {
-               my $dbh = $c->model;
-
-               my $password = generate_random_string 16;
-               my $update = $dbh->do(q{
-UPDATE users SET password = $1
-WHERE uid = $2 AND password IS NULL
-                       },undef,$password,$c->uid);
-               if ($update > 0){
-                       $c->reply("Password set to: $password (you can change it on webbie)");
-               }else{
-                       $c->reply("Couldn't set password. Either it has already been set or you don't have an account");
-               }
-       }
-};
-
 1;
 1;
index a5e3abf8a70ff478cc01e5ac9640b112e2760722..2b6176041287019a27c1c5af76e5a191612ba0bf 100644 (file)
@@ -549,4 +549,45 @@ ORDER BY amount*(metal+crystal+eonium)*CASE WHEN $1 = t1 THEN 1.0 ELSE 0.6 END D
        }
 };
 
        }
 };
 
+command getpass => {
+       help => q(Gives new users a random password.),
+       type => q(pm)
+}, class extends NDIRC::Command {
+
+###########################################################
+# Written by Guy Malachi http://guymal.com
+# 18 August, 2002
+###########################################################
+       sub generate_random_string
+       {
+               my $length_of_randomstring=shift;# the length of
+               # the random string to generate
+
+               my @chars=('a'..'z','A'..'Z','0'..'9','_');
+               my $random_string;
+               foreach (1..$length_of_randomstring)
+               {
+                       # rand @chars will generate a random
+                       # number between 0 and scalar @chars
+                       $random_string .= $chars[rand @chars];
+               }
+               return $random_string;
+       }
+
+       method execute ($c,$msg) {
+               my $dbh = $c->model;
+
+               my $password = generate_random_string 16;
+               my $update = $dbh->do(q{
+UPDATE users SET password = $1
+WHERE uid = $2 AND password IS NULL
+                       },undef,$password,$c->uid);
+               if ($update > 0){
+                       $c->reply("Password set to: $password (you can change it on webbie)");
+               }else{
+                       $c->reply("Couldn't set password. Either it has already been set or you don't have an account");
+               }
+       }
+};
+
 1;
 1;