| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Form::Processor::Field::Password; | 
| 2 |  |  |  |  |  |  | $Form::Processor::Field::Password::VERSION = '1.162360'; | 
| 3 | 2 |  |  | 2 |  | 859 | use strict; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 44 |  | 
| 4 | 2 |  |  | 2 |  | 5 | use warnings; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 41 |  | 
| 5 | 2 |  |  | 2 |  | 6 | use base 'Form::Processor::Field::Text'; | 
|  | 2 |  |  |  |  | 1 |  | 
|  | 2 |  |  |  |  | 615 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | # use Data::Password (); | 
| 8 |  |  |  |  |  |  | # | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 0 |  |  | 0 | 1 | 0 | sub init_widget     { return 'password' } | 
| 12 | 2 |  |  | 2 | 0 | 12 | sub init_min_length { return 6 } | 
| 13 | 0 |  |  | 0 | 0 | 0 | sub init_password   { return 1 } | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub validate { | 
| 18 | 9 |  |  | 9 | 1 | 7 | my $self = shift; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 9 | 100 |  |  |  | 23 | return unless $self->SUPER::validate; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 7 |  |  |  |  | 8 | my $value = $self->input; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 7 | 50 |  |  |  | 12 | return $self->add_error( 'Passwords must not contain spaces' ) | 
| 25 |  |  |  |  |  |  | if $value =~ /\s/; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 7 | 100 |  |  |  | 21 | return $self->add_error( 'Passwords must be made up from letters, digits, or the underscore' ) | 
| 28 |  |  |  |  |  |  | if $value =~ /\W/; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | #return $self->add_error( 'Passwords must include one or more digits' ) | 
| 31 |  |  |  |  |  |  | #    unless $value =~ /\d/; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 6 | 100 |  |  |  | 20 | return $self->add_error( 'Passwords must not be all digits' ) | 
| 34 |  |  |  |  |  |  | if $value =~ /^\d+$/; | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | # This is too strcit. | 
| 40 |  |  |  |  |  |  | # Need to make sure it doesn't match login | 
| 41 |  |  |  |  |  |  | # my $msg = Data::Password::IsBadPassword( $self->input ); | 
| 42 |  |  |  |  |  |  | #return $self->SUPER::validate unless $msg; | 
| 43 |  |  |  |  |  |  | #$self->add_error( $msg ); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | # So hack it. | 
| 46 | 5 |  |  |  |  | 10 | my $params = $self->form->params; | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 5 |  |  |  |  | 24 | for ( qw/ login username / ) { | 
| 49 | 9 | 50 |  |  |  | 18 | next if $self->name eq $_; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | return $self->add_error( 'Password must not match ' . $_ ) | 
| 52 | 9 | 100 | 66 |  |  | 41 | if $params->{$_} && $params->{$_} eq $value; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 3 |  |  |  |  | 10 | return 1; | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 |  |  | 0 | 1 |  | sub required_message { return 'Please enter a password in this field' } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | # ABSTRACT: Input a password | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | 1; | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | __END__ |