Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[November] various changes
- made sure conditionals don't trigger undef warnings
- changed to single-quoted strings
- reworded strings and comments
  • Loading branch information
Carl Masak committed Nov 24, 2009
1 parent 9089b28 commit e7ff443
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/November.pm
Expand Up @@ -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');
}
Expand Down

0 comments on commit e7ff443

Please sign in to comment.