line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::Element::Password; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
654
|
use strict; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
233
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
19
|
use Moose; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
37
|
|
7
|
6
|
|
|
6
|
|
27924
|
use MooseX::Attribute::FormFuChained; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
223
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Element'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'HTML::FormFu::Role::Element::Input'; |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
20
|
use HTML::FormFu::Constants qw( $EMPTY_STR ); |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
1473
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has render_value => ( is => 'rw', traits => ['FormFuChained'] ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
after BUILD => sub { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$self->field_type('password'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return; |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub process_value { |
26
|
12
|
|
|
12
|
|
17
|
my ( $self, $value ) = @_; |
27
|
|
|
|
|
|
|
|
28
|
12
|
|
|
|
|
25
|
my $submitted = $self->form->submitted; |
29
|
12
|
|
|
|
|
19
|
my $new; |
30
|
|
|
|
|
|
|
|
31
|
12
|
100
|
100
|
|
|
228
|
if ( $submitted && $self->render_value ) { |
|
|
100
|
|
|
|
|
|
32
|
5
|
100
|
|
|
|
19
|
$new |
33
|
|
|
|
|
|
|
= defined $value |
34
|
|
|
|
|
|
|
? $value |
35
|
|
|
|
|
|
|
: $EMPTY_STR; |
36
|
|
|
|
|
|
|
|
37
|
5
|
100
|
66
|
|
|
151
|
if ( $self->retain_default && $new eq $EMPTY_STR ) { |
38
|
2
|
|
|
|
|
14
|
$new = $self->value; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
14
|
$self->value($new); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
elsif ($submitted) { |
44
|
3
|
|
|
|
|
15
|
$new = $EMPTY_STR; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
4
|
|
|
|
|
8
|
$new = undef; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
12
|
|
|
|
|
36
|
return $new; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
HTML::FormFu::Element::Password - Password form field |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 2.05 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $element = $form->element( Password => 'foo' ); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DESCRIPTION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Password form field. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 METHODS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 render_value |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Normally, when a form is redisplayed because of errors, password fields |
80
|
|
|
|
|
|
|
lose their values, requiring the user to retype it. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
If C<render_value> is true, password fields won't lose their value. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Default value: false |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SEE ALSO |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from |
89
|
|
|
|
|
|
|
L<HTML::FormFu::Role::Element::Input>, |
90
|
|
|
|
|
|
|
L<HTML::FormFu::Role::Element::Field>, |
91
|
|
|
|
|
|
|
L<HTML::FormFu::Element> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L<HTML::FormFu> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
102
|
|
|
|
|
|
|
the same terms as Perl itself. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |