diff --git a/djangoapps/student/models.py b/djangoapps/student/models.py index e21084e20f..a4c01d52fc 100644 --- a/djangoapps/student/models.py +++ b/djangoapps/student/models.py @@ -32,12 +32,12 @@ class UserProfile(models.Model): def get_meta(self): js_str = self.meta - if not js: - js = dict() + if not js_str: + js_str = dict() else: - js = json.reads(self.meta) + js_str = json.loads(self.meta) - return js + return js_str def set_meta(self,js): self.meta = json.dumps(js) diff --git a/djangoapps/student/views.py b/djangoapps/student/views.py index 4a1dfbb546..017e1b3bb5 100644 --- a/djangoapps/student/views.py +++ b/djangoapps/student/views.py @@ -1,3 +1,4 @@ +import datetime import json import logging import random @@ -16,6 +17,7 @@ from django.db import connection from django.http import HttpResponse, Http404 from django.shortcuts import redirect from mitxmako.shortcuts import render_to_response, render_to_string +from mako import exceptions from django_future.csrf import ensure_csrf_cookie @@ -373,7 +375,7 @@ def confirm_email_change(request, key): meta = up.get_meta() if 'old_emails' not in meta: meta['old_emails'] = [] - meta['old_emails'].append(user.email) + meta['old_emails'].append([user.email, datetime.datetime.now().isoformat()]) up.set_meta(meta) up.save() user.email = pec.new_email @@ -450,7 +452,7 @@ def accept_name_change(request): meta = up.get_meta() if 'old_names' not in meta: meta['old_names'] = [] - meta['old_names'].append(up.name) + meta['old_names'].append([up.name, pnc.rationale, datetime.datetime.now().isoformat()]) up.set_meta(meta) up.name = pnc.new_name diff --git a/templates/emails/confirm_email_change.txt b/templates/emails/confirm_email_change.txt index 148b973384..b213847f98 100644 --- a/templates/emails/confirm_email_change.txt +++ b/templates/emails/confirm_email_change.txt @@ -3,7 +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://${sitename}/t/mitx_help.html + https://${ site }/t/mitx_help.html We keep a log of old e-mails, so if this request was unintentional, we can investigate. diff --git a/templates/profile.html b/templates/profile.html index 94eaba3cac..f63011243a 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -109,7 +109,7 @@ $(function() { if(data.success){ $("#apply_name_change").html("

Your request has been submitted.

We'll send you an e-mail if we approve the change or need further information. Please allow for up to a week for us to process your request.

"); } else { - $("#apply_name_change_error").html(data.error); + $("#change_name_error").html(data.error); } }); log_event("profile", {"type":"name_change_request",