emails: Fix spelling of "Unknown IP" and tag for translation.

This commit is contained in:
Tim Abbott 2018-04-30 12:04:01 -07:00
parent b72874226f
commit a4ff917789
2 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@ IGNORED_PHRASES = [
r"HTTP", r"HTTP",
r"ID", r"ID",
r"IDs", r"IDs",
r"IP",
r"JIRA", r"JIRA",
r"JSON", r"JSON",
r"Kerberos", r"Kerberos",

View File

@ -8,6 +8,7 @@ from django.template import loader
from django.utils.timezone import \ from django.utils.timezone import \
get_current_timezone_name as timezone_get_current_timezone_name get_current_timezone_name as timezone_get_current_timezone_name
from django.utils.timezone import now as timezone_now from django.utils.timezone import now as timezone_now
from django.utils.translation import ugettext_lazy as _
from zerver.lib.queue import queue_json_publish from zerver.lib.queue import queue_json_publish
from zerver.lib.send_email import FromAddress from zerver.lib.send_email import FromAddress
@ -73,7 +74,7 @@ def email_on_new_login(sender: Any, user: UserProfile, request: Any, **kwargs: A
context['user_email'] = user.email context['user_email'] = user.email
context['login_time'] = timezone_now().strftime('%A, %B %d, %Y at %I:%M%p ') + \ context['login_time'] = timezone_now().strftime('%A, %B %d, %Y at %I:%M%p ') + \
timezone_get_current_timezone_name() timezone_get_current_timezone_name()
context['device_ip'] = request.META.get('REMOTE_ADDR') or "Uknown IP address" context['device_ip'] = request.META.get('REMOTE_ADDR') or _("Unknown IP address")
context['device_os'] = get_device_os(user_agent) context['device_os'] = get_device_os(user_agent)
context['device_browser'] = get_device_browser(user_agent) context['device_browser'] = get_device_browser(user_agent)