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