From e0e382e0c697dfa044a5194eec13e434aee581ed Mon Sep 17 00:00:00 2001 From: Andrew Bastien Date: Fri, 24 Jul 2015 20:17:08 -0400 Subject: [PATCH] - Added .at_failed_login(session) to default Player typeclass. - unloggedin.CmdUnconnectedConnect now calls the at_failed_login hook on player if a correct user is entered by an invalid password provided. --- evennia/commands/default/unloggedin.py | 2 ++ evennia/players/players.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/evennia/commands/default/unloggedin.py b/evennia/commands/default/unloggedin.py index 0b53809736..30f15d2d50 100644 --- a/evennia/commands/default/unloggedin.py +++ b/evennia/commands/default/unloggedin.py @@ -166,6 +166,8 @@ class CmdUnconnectedConnect(MuxCommand): session.msg(string) # this just updates the throttle _throttle(session, storage=_LATEST_FAILED_LOGINS) + # calls player hook for a failed login. + player.at_failed_login(session) return # Check IP and/or name bans diff --git a/evennia/players/players.py b/evennia/players/players.py index d334c08b77..c65c8b0064 100644 --- a/evennia/players/players.py +++ b/evennia/players/players.py @@ -677,6 +677,16 @@ class DefaultPlayer(PlayerDB): # screen. We execute look on the player. self.execute_cmd("look", sessid=sessid) + def at_failed_login(self, session): + """ + Called by the login process if a user account is targeted correctly + but provided with an invalid password. By default it does nothing, + but exists to be overriden. + + Args: + session (session): Session logging in. + """ + def at_disconnect(self, reason=None): """ Called just before user is disconnected.