Skip to content

Commit

Permalink
Merge branch 'master' of github.com:davorg/kinza
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Sep 17, 2015
2 parents d93a462 + 488caf2 commit 4003601
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Kinza/lib/Kinza.pm
Expand Up @@ -202,7 +202,7 @@ post '/register' => sub {

session 'error', undef;

unless ($email = param('email')
unless ($email = lc param('email')
and $pass1 = param('password') and $pass2 = param('password2')) {
session 'error' => 'You must fill in all values';
return redirect '/register';
Expand Down Expand Up @@ -289,7 +289,7 @@ post '/resend' => sub {
}

$student->update({
email => param('email'),
email => lc param('email'),
});
# reread from database
$student->discard_changes;
Expand All @@ -316,7 +316,7 @@ post '/login' => sub {
}

my $user = $rs{Student}->find({
email => params->{email},
email => lc params->{email},
});
unless ($user) {
session 'error' => 'Invalid email or password';
Expand Down Expand Up @@ -356,7 +356,7 @@ post '/password' => sub {
session 'error' => 'You must give an email address';
return redirect '/password';
}
my $email = params->{email};
my $email = lc params->{email};
my $student = $rs{Student}->find({
email => $email,
});
Expand Down
12 changes: 12 additions & 0 deletions Kinza/lib/Kinza/Schema/Result/Student.pm
Expand Up @@ -194,6 +194,18 @@ sub allowed_courses {
return $self->form->year->allowed_courses;
}

sub is_registered {
my $self = shift;

return length $self->password;
}

sub is_verified {
my $self = shift;

return $self->is_registered && ! $self->verify;
}

# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;
10 changes: 10 additions & 0 deletions Kinza/views/layouts/main.tt
Expand Up @@ -58,6 +58,16 @@
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="/javascripts/kinza.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-56332-53', 'auto');
ga('send', 'pageview');

</script>
</body>
</html>

5 changes: 3 additions & 2 deletions Kinza/views/login.tt
Expand Up @@ -26,8 +26,9 @@
<button type="submit" class="btn btn-default">Log in</button>
</div>
</div>
<div class="col-sm-offset-2 col-sm-4">
<span class="small"><a href="/password">Forgotten password</a> </span>
<div class="col-sm-offset-2 col-sm-5">
<span class="small"><a href="/password">Forgotten password</a>.<br>
Or perhaps you need to <a href="/register">register</a> first</span>
</div>
</form>

9 changes: 5 additions & 4 deletions Kinza/views/years.tt
Expand Up @@ -9,13 +9,14 @@ END -%]

<table class="table table-bordered table-hover">
[% FOREACH year IN years.all.sort('seq') -%]
<tr><th colspan="4"><h2>[% year.name %]</h2></th></tr>
<tr><th colspan="5"><h2>[% year.name %]</h2></th></tr>
[% FOREACH form IN year.forms.sort('name') -%]
<tr><th colspan="4"><h3>[% form.name %]</h3></th></tr>
<tr><th>Name</th><th>Email</th><th>Registered</th><th>Selected</th></td>
<tr><th colspan="5"><h3>[% form.name %]</h3></th></tr>
<tr><th>Name</th><th>Email</th><th>Registered</th><th>Verified</th><th>Selected</th></td>
[% FOREACH student IN form.students.sort('name') -%]
<tr><td>[% student.name %]</td><td>[% student.email %]</td>
<td>[% ok(student.password) %]</td>
<td>[% ok(student.is_registered) %]</td>
<td>[% ok(student.is_verified) %]</td>
<td>[% ok(student.locked) %]</td></tr>
[% END -%]
[% END -%]
Expand Down
18 changes: 6 additions & 12 deletions db_schema/courses.txt
Expand Up @@ -41,28 +41,22 @@ Max 30
Ceramic Tea Party
All terms
All ages
Max 30
Max 24

Chess
All terms
All ages
Max 30

Duke of Edinburgh - Bronze
M
M,L
L5
1000

Duke of Edinburgh - Silver
L
U5,L6
1000
30

Duke of Edinburgh - Gold
S
L6
1000

L6,U6
40

German Language and Culture
All terms
Expand Down Expand Up @@ -90,7 +84,7 @@ L5,U5,L6,U6
Max 30

Loops, Riffs and Beats
All terms
S
All ages
Max 15

Expand Down

0 comments on commit 4003601

Please sign in to comment.