User: Only require name for set.password when changing other user's password.

Closes: Sf#3055358
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2010-08-29 11:10:54 -04:00
parent f977a3a260
commit de726f90f3
1 changed files with 7 additions and 3 deletions

View File

@ -168,7 +168,7 @@ class User(callbacks.Plugin):
class set(callbacks.Commands):
def password(self, irc, msg, args, user, password, newpassword):
"""<name> <old password> <new password>
"""[<name>] <old password> <new password>
Sets the new password for the user specified by <name> to <new
password>. Obviously this message must be sent to the bot
@ -180,6 +180,10 @@ class User(callbacks.Plugin):
u = ircdb.users.getUser(msg.prefix)
except KeyError:
u = None
if user is None:
if u is None:
irc.errorNotRegistered(Raise=True)
user = u
if user.checkPassword(password) or \
(u and u._checkCapability('owner') and not u == user):
user.setPassword(newpassword)
@ -187,8 +191,8 @@ class User(callbacks.Plugin):
irc.replySuccess()
else:
irc.error(conf.supybot.replies.incorrectAuthentication())
password = wrap(password, ['private', 'otherUser', 'something',
'something'])
password = wrap(password, ['private', optional('otherUser'),
'something', 'something'])
def secure(self, irc, msg, args, user, password, value):
"""<password> [<True|False>]