NickAuth & User: Fix nick auth + gpg auth when secure flag is on. Closes GH-825.

This commit is contained in:
Valentin Lorentz 2014-08-26 13:59:24 +02:00
parent 92c76044ec
commit a440d6ddf4
2 changed files with 12 additions and 2 deletions

View File

@ -161,7 +161,12 @@ class NickAuth(callbacks.Plugin):
if not user:
user = ircdb.users.getUserFromNick(irc.network, theirnick)
if user:
user.addAuth(prefix)
try:
user.addAuth(prefix)
except ValueError:
irc.error(_('Your secure flag is true and your hostmask '
'doesn\'t match any of your known hostmasks.'),
Raise=True)
ircdb.users.setUser(user, flush=False)
irc.reply(_('You are now authenticated as %s.') % user.name)
else:

View File

@ -522,7 +522,12 @@ class User(callbacks.Plugin):
found = False
for (id, user) in ircdb.users.items():
if keyid in [x[-len(keyid):] for x in user.gpgkeys]:
user.addAuth(msg.prefix)
try:
user.addAuth(msg.prefix)
except ValueError:
irc.error(_('Your secure flag is true and your '
'hostmask doesn\'t match any of your '
'known hostmasks.'), Raise=True)
ircdb.users.setUser(user, flush=False)
irc.reply(_('You are now authenticated as %s.') %
user.name)