mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Better.
This commit is contained in:
parent
f515617529
commit
591e66664d
25
src/User.py
25
src/User.py
@ -141,21 +141,24 @@ class User(callbacks.Privmsg):
|
|||||||
Unregisters <name> from the user database. If the user giving this
|
Unregisters <name> from the user database. If the user giving this
|
||||||
command is an owner user, the password is not necessary.
|
command is an owner user, the password is not necessary.
|
||||||
"""
|
"""
|
||||||
if conf.supybot.databases.users.allowUnregistration():
|
try:
|
||||||
if not user.checkPassword(password):
|
caller = ircdb.users.getUser(msg.prefix)
|
||||||
try:
|
isOwner = caller.checkCapability('owner')
|
||||||
user = ircdb.users.getUser(msg.prefix)
|
except KeyError:
|
||||||
except KeyError:
|
caller = None
|
||||||
user = None
|
if not conf.supybot.databases.users.allowUnregistration():
|
||||||
if not user or not user.checkCapability('owner'):
|
if not caller or not isOwner:
|
||||||
irc.error(conf.supybot.replies.incorrectAuthentication())
|
self.log.warning('%s tried to unregister user %s.',
|
||||||
|
msg.prefix, user.name)
|
||||||
|
irc.error('This command has been disabled. You\'ll have to '
|
||||||
|
'ask the owner of this bot to unregister your user.')
|
||||||
|
if isOwner or user.checkPassword(password):
|
||||||
ircdb.users.delUser(user.id)
|
ircdb.users.delUser(user.id)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
else:
|
||||||
irc.error('This command has been disabled. You\'ll have to ask '
|
irc.error(conf.supybot.replies.incorrectAuthentication())
|
||||||
'the owner of this bot to unregister your user.')
|
|
||||||
unregister = wrap(unregister, ['private', 'otherUser',
|
unregister = wrap(unregister, ['private', 'otherUser',
|
||||||
additional('something', '')])
|
additional('anything')])
|
||||||
|
|
||||||
def changename(self, irc, msg, args, user, newname, password):
|
def changename(self, irc, msg, args, user, newname, password):
|
||||||
"""<name> <new name> [<password>]
|
"""<name> <new name> [<password>]
|
||||||
|
@ -752,6 +752,8 @@ registerGlobalValue(supybot.databases.users, 'allowUnregistration',
|
|||||||
registry.Boolean(False, """Determines whether the bot will allow users to
|
registry.Boolean(False, """Determines whether the bot will allow users to
|
||||||
unregister their users. This can wreak havoc with already-existing
|
unregister their users. This can wreak havoc with already-existing
|
||||||
databases, so by default we don't allow it. Enable this at your own risk.
|
databases, so by default we don't allow it. Enable this at your own risk.
|
||||||
|
(Do also note that this does not prevent the owner of the bot from using
|
||||||
|
the unregister command.)
|
||||||
"""))
|
"""))
|
||||||
registerGlobalValue(supybot.databases.users, 'hash',
|
registerGlobalValue(supybot.databases.users, 'hash',
|
||||||
registry.Boolean(True, """Determines whether the passwords in the user
|
registry.Boolean(True, """Determines whether the passwords in the user
|
||||||
|
Loading…
Reference in New Issue
Block a user