Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
51d85809
Commit
51d85809
authored
Jun 22, 2016
by
Douglas Hall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix default from email lookups
parent
7b86da02
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
14 deletions
+19
-14
common/djangoapps/student/forms.py
+1
-1
common/djangoapps/student/tests/test_email.py
+2
-2
common/djangoapps/student/tests/test_reset_password.py
+1
-1
common/djangoapps/student/views.py
+4
-4
lms/djangoapps/bulk_email/tasks.py
+1
-1
lms/templates/emails/confirm_email_change.txt
+8
-3
openedx/core/djangoapps/credit/email_utils.py
+1
-1
openedx/core/djangoapps/user_api/accounts/api.py
+1
-1
No files found.
common/djangoapps/student/forms.py
View file @
51d85809
...
@@ -58,7 +58,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
...
@@ -58,7 +58,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
email_template_name
=
'registration/password_reset_email.html'
,
email_template_name
=
'registration/password_reset_email.html'
,
use_https
=
False
,
use_https
=
False
,
token_generator
=
default_token_generator
,
token_generator
=
default_token_generator
,
from_email
=
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
),
from_email
=
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
),
request
=
None
request
=
None
):
):
"""
"""
...
...
common/djangoapps/student/tests/test_email.py
View file @
51d85809
...
@@ -57,7 +57,7 @@ class EmailTestMixin(object):
...
@@ -57,7 +57,7 @@ class EmailTestMixin(object):
email_user
.
assert_called_with
(
email_user
.
assert_called_with
(
mock_render_to_string
(
subject_template
,
subject_context
),
mock_render_to_string
(
subject_template
,
subject_context
),
mock_render_to_string
(
body_template
,
body_context
),
mock_render_to_string
(
body_template
,
body_context
),
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
)
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
)
)
)
def
append_allowed_hosts
(
self
,
hostname
):
def
append_allowed_hosts
(
self
,
hostname
):
...
@@ -298,7 +298,7 @@ class EmailChangeRequestTests(EventTestMixin, TestCase):
...
@@ -298,7 +298,7 @@ class EmailChangeRequestTests(EventTestMixin, TestCase):
send_mail
.
assert_called_with
(
send_mail
.
assert_called_with
(
mock_render_to_string
(
'emails/email_change_subject.txt'
,
context
),
mock_render_to_string
(
'emails/email_change_subject.txt'
,
context
),
mock_render_to_string
(
'emails/email_change.txt'
,
context
),
mock_render_to_string
(
'emails/email_change.txt'
,
context
),
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
),
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
),
[
new_email
]
[
new_email
]
)
)
self
.
assert_event_emitted
(
self
.
assert_event_emitted
(
...
...
common/djangoapps/student/tests/test_reset_password.py
View file @
51d85809
...
@@ -125,7 +125,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
...
@@ -125,7 +125,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
(
subject
,
msg
,
from_addr
,
to_addrs
)
=
send_email
.
call_args
[
0
]
(
subject
,
msg
,
from_addr
,
to_addrs
)
=
send_email
.
call_args
[
0
]
self
.
assertIn
(
"Password reset"
,
subject
)
self
.
assertIn
(
"Password reset"
,
subject
)
self
.
assertIn
(
"You're receiving this e-mail because you requested a password reset"
,
msg
)
self
.
assertIn
(
"You're receiving this e-mail because you requested a password reset"
,
msg
)
self
.
assertEquals
(
from_addr
,
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
))
self
.
assertEquals
(
from_addr
,
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
))
self
.
assertEquals
(
len
(
to_addrs
),
1
)
self
.
assertEquals
(
len
(
to_addrs
),
1
)
self
.
assertIn
(
self
.
user
.
email
,
to_addrs
)
self
.
assertIn
(
self
.
user
.
email
,
to_addrs
)
...
...
common/djangoapps/student/views.py
View file @
51d85809
...
@@ -2229,11 +2229,11 @@ def reactivation_email_for_user(user):
...
@@ -2229,11 +2229,11 @@ def reactivation_email_for_user(user):
message
=
render_to_string
(
'emails/activation_email.txt'
,
context
)
message
=
render_to_string
(
'emails/activation_email.txt'
,
context
)
try
:
try
:
user
.
email_user
(
subject
,
message
,
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
))
user
.
email_user
(
subject
,
message
,
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
))
except
Exception
:
# pylint: disable=broad-except
except
Exception
:
# pylint: disable=broad-except
log
.
error
(
log
.
error
(
u'Unable to send reactivation email from "
%
s"'
,
u'Unable to send reactivation email from "
%
s"'
,
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
),
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
),
exc_info
=
True
exc_info
=
True
)
)
return
JsonResponse
({
return
JsonResponse
({
...
@@ -2357,7 +2357,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
...
@@ -2357,7 +2357,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user
.
email_user
(
user
.
email_user
(
subject
,
subject
,
message
,
message
,
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
)
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
)
)
)
except
Exception
:
# pylint: disable=broad-except
except
Exception
:
# pylint: disable=broad-except
log
.
warning
(
'Unable to send confirmation email to old address'
,
exc_info
=
True
)
log
.
warning
(
'Unable to send confirmation email to old address'
,
exc_info
=
True
)
...
@@ -2373,7 +2373,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
...
@@ -2373,7 +2373,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user
.
email_user
(
user
.
email_user
(
subject
,
subject
,
message
,
message
,
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
)
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
)
)
)
except
Exception
:
# pylint: disable=broad-except
except
Exception
:
# pylint: disable=broad-except
log
.
warning
(
'Unable to send confirmation email to new address'
,
exc_info
=
True
)
log
.
warning
(
'Unable to send confirmation email to new address'
,
exc_info
=
True
)
...
...
lms/djangoapps/bulk_email/tasks.py
View file @
51d85809
...
@@ -389,7 +389,7 @@ def _get_source_address(course_id, course_title, truncate=True):
...
@@ -389,7 +389,7 @@ def _get_source_address(course_id, course_title, truncate=True):
course_title
=
course_title_no_quotes
,
course_title
=
course_title_no_quotes
,
course_name
=
course_name
,
course_name
=
course_name
,
from_email
=
theming_helpers
.
get_value
(
from_email
=
theming_helpers
.
get_value
(
'
bulk_email_default_from_email
'
,
'
email_from_address
'
,
settings
.
BULK_EMAIL_DEFAULT_FROM_EMAIL
settings
.
BULK_EMAIL_DEFAULT_FROM_EMAIL
)
)
)
)
...
...
lms/templates/emails/confirm_email_change.txt
View file @
51d85809
<%! from django.core.urlresolvers import reverse %>
<%! from django.core.urlresolvers import reverse %>
<%! from django.utils.translation import ugettext as _ %>
<%! from django.utils.translation import ugettext as _ %>
<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
${_("This is to confirm that you changed the e-mail associated with "
${_("This is to confirm that you changed the e-mail associated with "
"{platform_name} from {old_email} to {new_email}. If you "
"{platform_name} from {old_email} to {new_email}. If you "
"did not make this request, please contact us immediately. Contact "
"did not make this request, please contact us immediately. Contact "
"information is listed at:").format(platform_name=settings.PLATFORM_NAME, old_email=old_email, new_email=new_email)}
"information is listed at:").format(
platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
old_email=old_email,
new_email=new_email
)
}
% if is_secure:
% if is_secure:
https://${ site }${reverse('contact')}
https://${ site }${reverse('contact')}
...
@@ -11,5 +17,4 @@ ${_("This is to confirm that you changed the e-mail associated with "
...
@@ -11,5 +17,4 @@ ${_("This is to confirm that you changed the e-mail associated with "
http://${ site }${reverse('contact')}
http://${ site }${reverse('contact')}
% endif
% endif
${_("We keep a log of old e-mails, so if this request was unintentional, we "
${_("We keep a log of old e-mails, so if this request was unintentional, we can investigate.")}
"can investigate.")}
openedx/core/djangoapps/credit/email_utils.py
View file @
51d85809
...
@@ -125,7 +125,7 @@ def send_credit_notifications(username, course_key):
...
@@ -125,7 +125,7 @@ def send_credit_notifications(username, course_key):
notification_msg
.
attach
(
logo_image
)
notification_msg
.
attach
(
logo_image
)
# add email addresses of sender and receiver
# add email addresses of sender and receiver
from_address
=
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
)
from_address
=
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
)
to_address
=
user
.
email
to_address
=
user
.
email
# send the root email message
# send the root email message
...
...
openedx/core/djangoapps/user_api/accounts/api.py
View file @
51d85809
...
@@ -398,7 +398,7 @@ def request_password_change(email, orig_host, is_secure):
...
@@ -398,7 +398,7 @@ def request_password_change(email, orig_host, is_secure):
# Generate a single-use link for performing a password reset
# Generate a single-use link for performing a password reset
# and email it to the user.
# and email it to the user.
form
.
save
(
form
.
save
(
from_email
=
theming_helpers
.
get_value
(
'
default_from_email
'
,
settings
.
DEFAULT_FROM_EMAIL
),
from_email
=
theming_helpers
.
get_value
(
'
email_from_address
'
,
settings
.
DEFAULT_FROM_EMAIL
),
domain_override
=
orig_host
,
domain_override
=
orig_host
,
use_https
=
is_secure
use_https
=
is_secure
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment