From 6ed9d04c2938b70e215d69e71e48d15edbba0a2b Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 14 Sep 2015 09:35:24 +0100 Subject: [PATCH 1/9] Always use lower case version of student's email address. --- Kinza/lib/Kinza.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kinza/lib/Kinza.pm b/Kinza/lib/Kinza.pm index 9c62358..c71aa69 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, }); From ee126a31d8606e9626ed21efcffa8c23122b73fc Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 09:16:54 +0100 Subject: [PATCH 2/9] Added Google Analytics --- Kinza/views/layouts/main.tt | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 @@ + From 8b38bea9bdec191717cc7e5327e163fa5972b089 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 12:20:37 +0100 Subject: [PATCH 3/9] Tweaks to courses --- db_schema/courses.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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 From 67cbbf2cf06bf8cde51ba090a6250d3aa827848d Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 12:52:10 +0100 Subject: [PATCH 4/9] Add 'verified' column. --- Kinza/views/years.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index cc56bdd..6048d79 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -12,10 +12,11 @@ END -%]

[% year.name %]

[% FOREACH form IN year.forms.sort('name') -%]

[% form.name %]

-NameEmailRegisteredSelected +NameEmailRegisteredVerifiedSelected [% FOREACH student IN form.students.sort('name') -%] [% student.name %][% student.email %] [% ok(student.password) %] +[% ok(student.password AND NOT student.verify) %] [% ok(student.locked) %] [% END -%] [% END -%] From 1f656c7344cd7f30b4eacb2ed06e1952504e01be Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 15:21:41 +0100 Subject: [PATCH 5/9] Add useful is_registered and is_verified methods to student. --- Kinza/lib/Kinza/Schema/Result/Student.pm | 12 ++++++++++++ Kinza/views/years.tt | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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/years.tt b/Kinza/views/years.tt index 6048d79..aac01af 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -15,8 +15,8 @@ END -%] NameEmailRegisteredVerifiedSelected [% FOREACH student IN form.students.sort('name') -%] [% student.name %][% student.email %] -[% ok(student.password) %] -[% ok(student.password AND NOT student.verify) %] +[% ok(student.is_registered) %] +[% ok(student.is_verified) %] [% ok(student.locked) %] [% END -%] [% END -%] From 1b63a9194dae41da54307b20852557d09ad46bf0 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Tue, 15 Sep 2015 16:39:37 +0100 Subject: [PATCH 6/9] Fix colspan to take new column into account --- Kinza/views/years.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kinza/views/years.tt b/Kinza/views/years.tt index aac01af..3e091e6 100644 --- a/Kinza/views/years.tt +++ b/Kinza/views/years.tt @@ -9,9 +9,9 @@ END -%] [% FOREACH year IN years.all.sort('seq') -%] - + [% FOREACH form IN year.forms.sort('name') -%] - + [% FOREACH student IN form.students.sort('name') -%] From e835251e6e78bcb7c2ae7226b531356889df933a Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:21:49 +0100 Subject: [PATCH 7/9] Added more help on the login page --- Kinza/views/login.tt | 1 + 1 file changed, 1 insertion(+) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 99ca6d5..4d4509c 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -28,6 +28,7 @@
Forgotten password + Or perhaps you need to register first
From 3cae0fb4caa9264e14fbaf9feb0ae70204775d03 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:23:12 +0100 Subject: [PATCH 8/9] Make it a bit prettier --- Kinza/views/login.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 4d4509c..1cfdd66 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -27,8 +27,8 @@
- Forgotten password - Or perhaps you need to register first + Forgotten password.
+ Or perhaps you need to register first
From 488caf29412f41df8c3656e3ba972c0106aa364c Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Wed, 16 Sep 2015 17:24:30 +0100 Subject: [PATCH 9/9] Another tweak --- Kinza/views/login.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kinza/views/login.tt b/Kinza/views/login.tt index 1cfdd66..19bc2a7 100644 --- a/Kinza/views/login.tt +++ b/Kinza/views/login.tt @@ -26,7 +26,7 @@ -
+
Forgotten password.
Or perhaps you need to register first

[% year.name %]

[% year.name %]

[% form.name %]

[% form.name %]

NameEmailRegisteredVerifiedSelected
[% student.name %][% student.email %]