Browse files

[November] various changes

- made sure conditionals don't trigger undef warnings
- changed to single-quoted strings
- reworded strings and comments
  • Loading branch information...
1 parent 9089b28 commit e7ff4433d0f34159698c40923ef470300603aa10 @masak masak committed Nov 24, 2009
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/November.pm
View
19 lib/November.pm
@@ -201,34 +201,35 @@ class November does Session does Cache {
}
method register {
- # Real work will come later.
if my $user_name = $.cgi.params<user_name> {
my $password = $.cgi.params<password>;
my $passagain = $.cgi.params<passagain>;
my Str @errors;
- unless defined $password {
- push @errors, "Please provide a password for your mask.";
+ if !defined $password || $password eq '' {
+ push @errors, 'Please provide a password.';
}
- if $password.chars < 6 {
- push @errors, "Please provide at least six characters for your password.";
+ if $password && $password.chars < 6 {
+ push @errors, 'Please provide at least six characters for '
+ 'your password.';
}
- if $password neq $passagain {
- push @errors, "The password and confirmation must match.";
+ if $password & $passagain && $password neq $passagain {
+ push @errors, 'The password and confirmation must match.';
}
if defined self.read_users(){$user_name} {
- push @errors, "This username is taken. Please choose another.";
+ push @errors, 'This username is taken. Please choose another.';
}
if @errors {
+ # TODO: Send @errors to template.
self.response('register_failed.tmpl');
return;
}
- # The actual writing takes place here.
+ # TODO: Implement registration code.
}
self.response('register.tmpl');
}

0 comments on commit e7ff443

Please sign in to comment.