]> ruin.nu Git - NDIRC.git/commitdiff
Use new password infrastructure
authorMichael Andreen <harv@ruin.nu>
Sat, 14 Jan 2017 13:04:08 +0000 (14:04 +0100)
committerMichael Andreen <harv@ruin.nu>
Sat, 14 Jan 2017 13:04:08 +0000 (14:04 +0100)
Commands/Channel.pm
Commands/Usermgm.pm
Delling.pm

index 21d34ed8a7be6e58437e0e90518743f9f6564149..62eae4f9bebd59e6eb353ad7bff927217cfcabdd 100644 (file)
@@ -142,10 +142,10 @@ command getpass => {
        method execute ($c,$msg) {
                my $dbh = $c->model;
 
-               my $password = generate_random_string 10;
+               my $password = generate_random_string 16;
                my $update = $dbh->do(q{
-UPDATE users SET password = MD5( ? )
-WHERE uid = ? AND password =''
+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)");
index 3501120f10d38b03f8e2b6343f5c98bea056dbf9..a5e3abf8a70ff478cc01e5ac9640b112e2760722 100644 (file)
@@ -45,7 +45,7 @@ FROM users WHERE username = $1 OR hostmask = $2 OR pnick = $3
                        $c->reply("<b>$username ($p_nick)</b> already exists with host: <b>$hostname</b>");
                }else{
                        $dbh->do(q{
-INSERT INTO users (username,hostmask,pnick,password) VALUES(?,?,?,'')
+INSERT INTO users (username,hostmask,pnick) VALUES($1,$2,$3)
                                },undef,$nick,$host,$pnick);
                        $c->reply("Added <b>$nick(/$pnick)</b> with host: <b>$host</b>");
                }
@@ -67,7 +67,7 @@ command '-user' => {
 
                if ($f->rows == 1){
                        my $updated = $dbh->do(q{
-UPDATE users SET hostmask = ?, password = '' WHERE uid = ?
+UPDATE users SET hostmask = $1, password = NULL WHERE uid = $2
                                },undef,$username,$uid);
                        if ($updated > 0){
                                my $groups = $dbh->do(q{DELETE FROM groupmembers WHERE uid = ?},undef,$uid);
index e6ce4e5e328b8a2042ae72c6b66b61e64246f7e5..62a9d363b3262483650e61750b554a81819220ef 100644 (file)
@@ -112,7 +112,7 @@ SELECT uid,pid,hostmask,password
 FROM users u WHERE hostmask = ?
                }, undef, $address);
                if ($user){
-                       if ($user->{password} eq ''){
+                       unless ($user->{password}) {
                                $irc->yield(privmsg => $disp->targets->{members}, "$nick: Get a new random password with /msg delling !getpass . If you don't know your username, then you can get it with .points");
                        }
                        if ($tick > 12 && not defined $user->{pid}){