Parent: [44233e] (diff)

Download this file

create_account.html    80 lines (63 with data), 1.9 kB

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