From 32cb8a2545403c46c67a572e0a61af2d9f77d160 Mon Sep 17 00:00:00 2001
From: Andrew Browning <ayleph@thisshitistemp.com>
Date: Tue, 15 Aug 2017 02:11:06 -0400
Subject: [PATCH] Fix #5460 - Log IP address for failed login
This patch logs the remote address when a login attempt fails.
---
mediagoblin/auth/views.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py
index 2f95fd81..fb8e7265 100644
|
a
|
b
|
|
| 14 | 14 | # You should have received a copy of the GNU Affero General Public License |
| 15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | 16 | |
| | 17 | import logging |
| | 18 | |
| 17 | 19 | import six |
| 18 | 20 | |
| 19 | 21 | from itsdangerous import BadSignature |
| … |
… |
from mediagoblin.tools.pluginapi import hook_handle
|
| 29 | 31 | from mediagoblin.auth.tools import (send_verification_email, register_user, |
| 30 | 32 | check_login_simple) |
| 31 | 33 | |
| | 34 | _log = logging.getLogger(__name__) |
| | 35 | |
| 32 | 36 | |
| 33 | 37 | @allow_registration |
| 34 | 38 | @auth_enabled |
| … |
… |
def login(request):
|
| 105 | 109 | return redirect(request, "index") |
| 106 | 110 | |
| 107 | 111 | login_failed = True |
| | 112 | remote_addr = request.access_route[-1] or request.remote_addr |
| | 113 | _log.warn("Failed login attempt from %r", remote_addr) |
| 108 | 114 | |
| 109 | 115 | return render_to_response( |
| 110 | 116 | request, |