From 187620dddcfc2cc00b29a4708438ca9f281e8cba Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 1 Apr 2009 14:33:19 -0400 Subject: [PATCH] User: Prevent set.password from failing with an unknown hostmask Signed-off-by: James Vega --- plugins/User/plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/User/plugin.py b/plugins/User/plugin.py index 65b37197c..3f8c765a6 100644 --- a/plugins/User/plugin.py +++ b/plugins/User/plugin.py @@ -176,9 +176,12 @@ class User(callbacks.Plugin): user (and the user whose password is being changed isn't that same owner user), then needn't be correct. """ - u = ircdb.users.getUser(msg.prefix) + try: + u = ircdb.users.getUser(msg.prefix) + except KeyError: + u = None if user.checkPassword(password) or \ - (u._checkCapability('owner') and not u == user): + (u and u._checkCapability('owner') and not u == user): user.setPassword(newpassword) ircdb.users.setUser(user) irc.replySuccess()