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
2b173379
Commit
2b173379
authored
Mar 20, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E-mail changes appear to work
parent
2e905dc7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
5 deletions
+35
-5
djangoapps/student/views.py
+10
-2
templates/emails/confirm_email_change.txt
+4
-1
templates/profile.html
+21
-2
No files found.
djangoapps/student/views.py
View file @
2b173379
...
...
@@ -308,7 +308,7 @@ def change_email_request(request):
new_email
=
request
.
POST
[
'new_email'
]
if
len
(
User
.
objects
.
filter
(
email
=
new_email
))
!=
0
:
## CRITICAL TODO: Handle case for e-mails
## CRITICAL TODO: Handle case
sensitivity
for e-mails
return
HttpResponse
(
json
.
dumps
({
'success'
:
False
,
'error'
:
'An account with this e-mail already exists.'
}))
...
...
@@ -349,13 +349,17 @@ def confirm_email_change(request, key):
try
:
pec
=
PendingEmailChange
.
objects
.
get
(
activation_key
=
key
)
except
:
return
render_to_response
(
"
email_invalid_key.html"
)
return
render_to_response
(
"
invalid_email_key.html"
,
{}
)
user
=
pec
.
user
d
=
{
'site'
:
settings
.
SITE_NAME
,
'old_email'
:
user
.
email
,
'new_email'
:
pec
.
new_email
}
if
len
(
User
.
objects
.
filter
(
email
=
pec
.
new_email
))
!=
0
:
return
render_to_response
(
"email_exists.html"
,
d
)
subject
=
render_to_string
(
'emails/email_change_subject.txt'
,
d
)
subject
=
''
.
join
(
subject
.
splitlines
())
message
=
render_to_string
(
'emails/confirm_email_change.txt'
,
d
)
...
...
@@ -383,6 +387,10 @@ def change_name_request(request):
pnc
.
user
=
request
.
User
pnc
.
new_name
=
request
.
POST
[
'new_name'
]
pnc
.
rationale
=
request
.
POST
[
'rationale'
]
if
len
(
pnc
.
new_name
)
<
2
:
return
HttpResponse
(
json
.
dumps
({
'success'
:
False
,
'error'
:
'Name required'
}))
if
len
(
pnc
.
rationale
)
<
2
:
return
HttpResponse
(
json
.
dumps
({
'success'
:
False
,
'error'
:
'Rationale required'
}))
pnc
.
save
()
return
HttpResponse
(
json
.
dumps
({
'success'
:
True
}))
...
...
templates/emails/confirm_email_change.txt
View file @
2b173379
...
...
@@ -3,4 +3,7 @@ from ${old_email} to ${new_email}. If you did not make this request,
please contact the course staff immediately. Contact information is
listed at:
https://6002x.mitx.mit.edu/t/mitx_help.html
https://${sitename}/t/mitx_help.html
We keep a log of old e-mails, so if this request was unintentional, we
can investigate.
templates/profile.html
View file @
2b173379
...
...
@@ -98,6 +98,25 @@ $(function() {
return
false
;
});
$
(
"#change_name_form"
).
submit
(
function
(){
var
new_name
=
$
(
'#new_name_field'
).
val
();
var
rationale
=
$
(
'#name_rationale_field'
).
val
();
postJSON
(
'/change_email'
,{
"new_name"
:
new_name
,
"rationale"
:
rationale
},
function
(
data
){
if
(
data
.
success
){
$
(
"#change_email"
).
html
(
"Request submitted. We'll send you an e-mail if we approve the change or need further information."
);
}
else
{
$
(
"#change_email_error"
).
html
(
data
.
error
);
}
});
log_event
(
"profile"
,
{
"type"
:
"name_change_request"
,
"new_name"
:
new_name
,
"rationale"
:
rationale
});
return
false
;
});
});
</script>
</
%
block>
...
...
@@ -214,11 +233,11 @@ $(function() {
<ul>
<li>
<label>
Enter your desired full name, as it will appear on the MITx Certificate:
</label>
<input
id=
"new_name"
value=
""
type=
"text"
/>
<input
id=
"new_name
_field
"
value=
""
type=
"text"
/>
</li>
<li>
<label>
Reason for name change:
</label>
<textarea
id=
"name_rationale"
value=
""
></textarea>
<textarea
id=
"name_rationale
_field
"
value=
""
></textarea>
</li>
<li>
<input
type=
"submit"
id=
"submit"
>
...
...
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