User: Prevent set.password from failing with an unknown hostmask

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-04-01 14:33:19 -04:00
parent c2a783c0b0
commit 187620dddc

View File

@ -176,9 +176,12 @@ class User(callbacks.Plugin):
user (and the user whose password is being changed isn't that same
owner user), then <old password> 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()