| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Password; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
719
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
26
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use parent 'HTML::FormWidgets'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( subtype width ) ); |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $NBSP = ' '; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
|
12
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
4
|
$self->subtype( 'normal' ); |
|
15
|
1
|
|
|
|
|
8
|
$self->width ( 20 ); |
|
16
|
1
|
|
|
|
|
6
|
return; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub render_field { |
|
21
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
3
|
my $hacc = $self->hacc; |
|
24
|
1
|
|
|
|
|
6
|
my $subtype = $self->subtype; |
|
25
|
1
|
50
|
|
|
|
7
|
my $reveal = $subtype =~ m{ reveal }msx ? 1 : 0; |
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
50
|
|
|
|
3
|
if ($reveal) { |
|
28
|
0
|
|
|
|
|
0
|
my $id2 = $args->{id}; $id2 =~ s{ 1 }{2}mx; |
|
|
0
|
|
|
|
|
0
|
|
|
29
|
0
|
|
|
|
|
0
|
my $options = { event => "[ 'focus', 'blur' ]", |
|
30
|
|
|
|
|
|
|
method => "[ 'show_password', 'hide_password' ]" }; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
$self->add_literal_js( 'inputs', $self->id, $options ); |
|
33
|
0
|
|
|
|
|
0
|
$self->add_literal_js( 'inputs', $id2, $options ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
1
|
50
|
|
|
|
5
|
$args->{class} .= ' ifield'.($reveal ? ' reveal' : q()); |
|
37
|
1
|
|
|
|
|
3
|
$args->{size } = $self->width; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
12
|
my $html = $hacc->password_field( $args ); |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
53
|
$subtype =~ m{ verify }msx or return $html; |
|
42
|
1
|
|
|
|
|
5
|
$html .= $hacc->span( { class => 'prompt' }, |
|
43
|
|
|
|
|
|
|
$NBSP.$self->loc( 'and again' ).$NBSP ); |
|
44
|
1
|
|
|
|
|
28
|
$args->{name} =~ s{ 1 }{2}mx; $args->{id} =~ s{ 1 }{2}mx; |
|
|
1
|
|
|
|
|
3
|
|
|
45
|
1
|
|
|
|
|
6
|
$html .= $hacc->password_field( $args ); |
|
46
|
1
|
|
|
|
|
41
|
return $html; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|