|
a/opensourceprojects/templates/create_account.html |
|
b/opensourceprojects/templates/create_account.html |
1 |
{% set hide_left_bar = True %}
|
1 |
{% set hide_left_bar = True %}
|
2 |
{% extends g.theme.master %}
|
2 |
{% extends g.theme.master %}
|
3 |
|
3 |
|
4 |
{% block title %}Create an Account{% endblock %}
|
4 |
{% block title %}Create an account{% endblock %}
|
5 |
|
5 |
|
6 |
{% block header %}Create an Account{% endblock %}
|
6 |
{% block header %}Creating a new account{% endblock %}
|
7 |
|
7 |
|
8 |
{% block content %}
|
8 |
{% block content %}
|
|
|
9 |
<div class="createacc">
|
9 |
<div class="grid-20">
|
10 |
<div class="grid-20 signform">
|
10 |
{{ c.form.display() }}
|
11 |
{{ c.form.display() }}
|
|
|
12 |
</div>
|
11 |
</div>
|
13 |
</div>
|
12 |
{% endblock %}
|
14 |
{% endblock %}
|
13 |
|
15 |
|
14 |
{% block extra_js %}
|
16 |
{% block extra_js %}
|
15 |
<script type="text/javascript">
|
17 |
<script type="text/javascript">
|
16 |
/*<![CDATA[*/
|
18 |
/*<![CDATA[*/
|
17 |
$('#create_account').submit(function () {
|
19 |
|
18 |
if (!$('#username').attr('value').match(/^[a-zA-Z0-9]+$/)) {
|
20 |
function unmark(inp) {
|
19 |
alert('Username can only contain numbers and letters.');
|
21 |
$(inp).parent('.fieldcontainer').removeClass('fielderror')
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
function mark_ok(inp) {
|
|
|
25 |
$(inp).parent('.fieldcontainer').removeClass('fielderror')
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
function mark_fail(inp, msg) {
|
|
|
29 |
$(inp).parent('.fieldcontainer').addClass('fielderror')
|
|
|
30 |
$(inp).siblings('.fielderror').children('.msg').text(msg);
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
function validEmail(email) {
|
|
|
34 |
var re = /\S+@\S+\.\S+/;
|
|
|
35 |
return re.test(email);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function check_mail(inp) {
|
|
|
39 |
if ( !validEmail(inp.value)) {
|
|
|
40 |
mark_fail(inp, 'Please enter a valid email address');
|
20 |
return false;
|
41 |
return false;
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
unmark(inp);
|
|
|
45 |
return true;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
function check_displayname(inp) {
|
|
|
49 |
if ( inp.value.length < 1) {
|
|
|
50 |
mark_fail(inp, 'Please enter a value');
|
|
|
51 |
} else {
|
|
|
52 |
unmark(inp);
|
21 |
}
|
53 |
}
|
22 |
if ($('#password').attr('value').length < 8) {
|
54 |
}
|
23 |
alert('Password must be at least 8 characters long.');
|
55 |
|
24 |
return false;
|
56 |
function check_username(inp) {
|
|
|
57 |
if (! inp.value.match(/^[a-z][-a-z0-9]*$/)) {
|
|
|
58 |
mark_fail(inp, 'Usernames must include only letters, numbers, and dashes.');
|
|
|
59 |
} else if (inp.value.length < 3) {
|
|
|
60 |
mark_fail(inp, 'The username must be at least 3 characters long');
|
|
|
61 |
} else {
|
|
|
62 |
unmark(inp);
|
25 |
}
|
63 |
}
|
26 |
if ($('#password').attr('value') !== $('#confirm_password').attr('value')) {
|
|
|
27 |
alert('Password and Confirm Password must match.');
|
|
|
28 |
return false;
|
|
|
29 |
}
|
64 |
}
|
|
|
65 |
|
|
|
66 |
$('form .displayname').blur(function() {
|
|
|
67 |
check_displayname(this);
|
30 |
});
|
68 |
});
|
31 |
/*]]>*/
|
69 |
|
|
|
70 |
$('form .username').blur(function() {
|
|
|
71 |
check_username(this);
|
|
|
72 |
});
|
|
|
73 |
|
|
|
74 |
$('form .email').blur(function(){
|
|
|
75 |
check_mail(this);
|
|
|
76 |
});
|
|
|
77 |
|
32 |
</script>
|
78 |
</script>
|
33 |
{% endblock %}
|
79 |
{% endblock %}
|