From 899a2860f3816042c168b995616fc7425732e878 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 14 Jan 2017 14:04:08 +0100 Subject: [PATCH] Use new password infrastructure --- Commands/Channel.pm | 6 +++--- Commands/Usermgm.pm | 4 ++-- Delling.pm | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Commands/Channel.pm b/Commands/Channel.pm index 21d34ed..62eae4f 100644 --- a/Commands/Channel.pm +++ b/Commands/Channel.pm @@ -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)"); diff --git a/Commands/Usermgm.pm b/Commands/Usermgm.pm index 3501120..a5e3abf 100644 --- a/Commands/Usermgm.pm +++ b/Commands/Usermgm.pm @@ -45,7 +45,7 @@ FROM users WHERE username = $1 OR hostmask = $2 OR pnick = $3 $c->reply("$username ($p_nick) already exists with host: $hostname"); }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 $nick(/$pnick) with host: $host"); } @@ -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); diff --git a/Delling.pm b/Delling.pm index e6ce4e5..62a9d36 100644 --- a/Delling.pm +++ b/Delling.pm @@ -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}){ -- 2.39.2