diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 2657abb..49a2b37 100644 --- a/Kinza/lib/Kinza.pm +++ b/Kinza/lib/Kinza.pm @@ -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'; @@ -289,7 +289,7 @@ post '/resend' => sub { } $student->update({ - email => param('email'), + email => lc param('email'), }); # reread from database $student->discard_changes; @@ -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'; @@ -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, }); diff --git a/Kinza/lib/Kinza/Schema/Result/Student.pm b/Kinza/lib/Kinza/Schema/Result/Student.pm index bcd2624..42293ca 100644 --- a/Kinza/lib/Kinza/Schema/Result/Student.pm +++ b/Kinza/lib/Kinza/Schema/Result/Student.pm @@ -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; diff --git a/Kinza/views/layouts/main.tt b/Kinza/views/layouts/main.tt index 95ac2ce..bb09718 100644 --- a/Kinza/views/layouts/main.tt +++ b/Kinza/views/layouts/main.tt @@ -58,6 +58,16 @@ + diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 99ca6d5..19bc2a7 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -26,8 +26,9 @@ -
- Forgotten password +
+ Forgotten password.
+ Or perhaps you need to register first
diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index cc56bdd..3e091e6 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -9,13 +9,14 @@ END -%] [% FOREACH year IN years.all.sort('seq') -%] - + [% FOREACH form IN year.forms.sort('name') -%] - - + + [% FOREACH student IN form.students.sort('name') -%] - + + [% END -%] [% END -%] diff --git a/db_schema/courses.txt b/db_schema/courses.txt index 4eaa142..9c4072a 100644 --- a/db_schema/courses.txt +++ b/db_schema/courses.txt @@ -41,7 +41,7 @@ Max 30 Ceramic Tea Party All terms All ages -Max 30 +Max 24 Chess All terms @@ -49,20 +49,14 @@ 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 @@ -90,7 +84,7 @@ L5,U5,L6,U6 Max 30 Loops, Riffs and Beats -All terms +S All ages Max 15

[% year.name %]

[% year.name %]

[% form.name %]

NameEmailRegisteredSelected

[% form.name %]

NameEmailRegisteredVerifiedSelected
[% student.name %][% student.email %][% ok(student.password) %][% ok(student.is_registered) %][% ok(student.is_verified) %] [% ok(student.locked) %]