Better logging. Tested and fixed bugs in previous commits
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -109,7 +109,7 @@ $(function() {
|
||||
if(data.success){
|
||||
$("#apply_name_change").html("<h1>Your request has been submitted.</h1><p>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.</p>");
|
||||
} else {
|
||||
$("#apply_name_change_error").html(data.error);
|
||||
$("#change_name_error").html(data.error);
|
||||
}
|
||||
});
|
||||
log_event("profile", {"type":"name_change_request",
|
||||
|
||||
Reference in New Issue
Block a user