update password reset form and change inputs to type submit and chmod executable html files

This commit is contained in:
Ernie Park
2012-02-01 11:51:24 -05:00
parent 92e5cff869
commit 9f093f985c
11 changed files with 35 additions and 34 deletions

View File

@@ -2,7 +2,7 @@
<div name="enroll_form" id="enroll_form">
<h1>Enroll in 6.002 Circuits &amp; Electronics</h1>
<form name="login" method="get">
<form name="enroll" id="enroll_form" method="get">
<fieldset><% if 'error' in locals(): e = error %>
<div id="enroll_error" name="enroll_error"></div>
@@ -67,6 +67,6 @@
</li>
</ol>
<input name="create_account_button" id="create_account_button" type="button" value="Create Account">
<input name="create_account_button" id="create_account_button" type="submit" value="Create Account">
</fieldset> </form>
</div>

View File

@@ -103,7 +103,8 @@ $(function() {
/* Handles when the user hits 'enroll'. Grabs form data. Does AJAX.
Either shows error, or shows success. */
$('#create_account_button').click(function() {
$('form#enroll_form').submit(function(e) {
e.preventDefault();
var submit_data={};
$.each($("[id^=ca_]"), function(index,value){
submit_data[value.name]=value.value;

View File

@@ -3,7 +3,7 @@ ${ error }
<div id="login_div">
<h1>Log in to MITx</h1>
<form name="login" action="/login" method="get">
<form id="login_form" method="post">
<div id="login_error"></div>
<ol>
<li>
@@ -21,7 +21,7 @@ ${ error }
</li>
</ol>
<input name="submit" id="login_button" type="button" value="Log in">
<input name="submit" id="login_button" type="submit" value="Log in">
</form>
<div class="lost-password">

View File

@@ -19,11 +19,11 @@
<script src="/static/js/html5shiv.js"></script>
<![endif]-->
<script type="text/javascript">
$(function(){
$("a[rel*=leanModal]").leanModal();
});
</script>
<script type="text/javascript">
$(function(){
$("a[rel*=leanModal]").leanModal();
});
</script>
<%block name="headextra"/>
@@ -66,14 +66,15 @@
</footer>
<div id="login" class="leanModal_box"><%include file="login.html" /></div>
<div id="pwd_reset" class="leanModal_box"><%include file="password_reset_form.html" /></div>
<div id="pwd_reset" class="leanModal_box"><%include file="registration/password_reset_form.html" /></div>
<div id="reset_done" class="leanModal_box"></div>
<script>
$(document).ready(function(){
/* Handles when the user tries to log in. Grabs form data. Does AJAX.
Either shows error, or redirects. */
$('#login_button').click(function() {
$('form#login_form').submit(function(e) {
e.preventDefault();
var submit_data={};
$.each($("[id^=li_]"), function(index,value){
submit_data[value.name]=value.value;
@@ -92,11 +93,21 @@ $(document).ready(function(){
);
});
$('#pwd_reset_button').click(function() {
$.post('/password_reset/',{ "csrfmiddlewaretoken" : "${ csrf }",
"email" : $('#id_email').val()}, function(data){
$('#pwd_reset').html(data);
});
$('form#pwd_reset_form').submit(function(e) {
e.preventDefault();
var submit_data = {};
submit_data['email'] = $('#id_email').val();
postJSON('/password_reset/',
submit_data,
function(json){
if (json.success) {
$('#pwd_reset').html(json.value);
} else {
$('#pwd_error').html(json.error);
}
}
);
});
});

View File

@@ -1,9 +0,0 @@
<h1>Password reset</h1>
<p>Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one.</p>
<form action="/password_reset/" method="post">
<input type='hidden' name='csrfmiddlewaretoken' value='${ csrf }' />
<label for="id_email">E-mail address:</label>
<input id="id_email" type="email" name="email" maxlength="75" /> <input type="button" id="pwd_reset_button" value="Reset my password" />
</form>

0
registration/password_reset_complete.html Executable file → Normal file
View File

0
registration/password_reset_confirm.html Executable file → Normal file
View File

4
registration/password_reset_done.html Executable file → Normal file
View File

@@ -1,7 +1,3 @@
{% block content %}
<h1>Password reset successful</h1>
<p>We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly.</p>
{% endblock %}

0
registration/password_reset_email.html Executable file → Normal file
View File

8
registration/password_reset_form.html Executable file → Normal file
View File

@@ -2,7 +2,9 @@
<p>Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one.</p>
<form action="" method="post">{% csrf_token %}
{{ form.email.errors }}
<p><label for="id_email">E-mail address:</label> {{ form.email }} <input type="submit" value="Reset my password" /></p>
<form id="pwd_reset_form">
<div id="pwd_error"></div>
<label for="id_email">E-mail address:</label>
<input id="id_email" type="email" name="email" maxlength="75" />
<input type="submit" id="pwd_reset_button" value="Reset my password" />
</form>

View File

@@ -93,7 +93,7 @@ div.leanModal_box {
}
}
input[type="button"] {
input[type="button"], input[type="submit"] {
@include button($mit-red);
font-size: 18px;
padding: lh(.5);