Commit 73df3141 by Matthew Mongeau

wip

parent 2f96527f
......@@ -150,17 +150,14 @@ def logout_user(request):
@login_required
@ensure_csrf_cookie
def change_setting(request):
''' JSON call to change a profile setting: Right now, location and language
''' JSON call to change a profile setting: Right now, location
'''
up = UserProfile.objects.get(user=request.user) #request.user.profile_cache
if 'location' in request.POST:
up.location=request.POST['location']
if 'language' in request.POST:
up.language=request.POST['language']
up.save()
return HttpResponse(json.dumps({'success':True,
'language':up.language,
'location':up.location,}))
@ensure_csrf_cookie
......@@ -171,7 +168,7 @@ def create_account(request, post_override=None):
post_vars = post_override if post_override else request.POST
# Confirm we have a properly formed request
for a in ['username', 'email', 'password', 'language', 'name']:
for a in ['username', 'email', 'password', 'name']:
if a not in post_vars:
js['value'] = "Error (401 {field}). E-mail us.".format(field=a)
return HttpResponse(json.dumps(js))
......@@ -238,7 +235,6 @@ def create_account(request, post_override=None):
up = UserProfile(user=u)
up.name = post_vars['name']
up.language = post_vars['language']
up.country = post_vars['country']
up.gender = post_vars['gender']
up.mailing_address = post_vars['mailing_address']
......@@ -288,7 +284,6 @@ def create_random_account(create_account_function):
'email' : id_generator(size=10, chars=string.ascii_lowercase) + "_dummy_test@mitx.mit.edu",
'password' : id_generator(),
'location' : id_generator(size=5, chars=string.ascii_uppercase),
'language' : id_generator(size=5, chars=string.ascii_uppercase) + "ish",
'name' : id_generator(size=5, chars=string.ascii_lowercase) + " " + id_generator(size=7, chars=string.ascii_lowercase),
'honor_code' : u'true',
'terms_of_service' : u'true',}
......
......@@ -16,9 +16,6 @@
<li>
<span class="title"><div class="icon location-icon"></div>Location</span><span class="data">${ user.profile.location }</span>
</li>
<li>
<span class="title"><div class="icon language-icon"></div>Language</span><span class="data">${ user.profile.language }</span>
</li>
</ul>
</section>
</header>
......
......@@ -49,26 +49,6 @@ $(function() {
}
});
$("#change_language").click(function() {
$(this).hide();
log_event("profile", {"type":"language_show", "old":$("#language_sub").text()});
if(lang) {
lang=false;
$("#language_sub").html('<form>'+'<input id="id_lang_text" type="text" name="lang_text" />'+
'<input type="submit" id="change_lang_button" value="Save" />'+'</form>');
$("#change_lang_button").click(function() {
$("#change_language").show();
postJSON('/change_setting', {'language':$("#id_lang_text").attr("value")}, function(json) {
$("#language_sub").text(json.language);
lang=true;
$("#description").html("");
log_event("profile", {"type":"language_change", "new":json.language});
});
});
}
});
$('#change_password').click(function(){
$('.modal').trigger('click');
log_event("profile", {"type":"password_show"});
......@@ -207,9 +187,6 @@ $(function() {
Location: <div id="location_sub">${location}</div><div id="description"></div> <a href="#" id="change_location" aria-label="Edit Location">Edit</a>
</li>
<li>
Language: <div id="language_sub">${language}</div> <a href="#" id="change_language" aria-label="Edit Language">Edit</a>
</li>
<li>
Password reset
<input id="id_email" type="hidden" name="email" maxlength="75" value="${email}" />
<input type="submit" id="pwd_reset_button" value="Reset" aria-label="Reset Password" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment