line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Password; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
657
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
3
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( subtype width ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $NBSP = ' '; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
1
|
|
|
1
|
1
|
3
|
my ($self, $args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
2
|
$self->subtype( 'normal' ); |
15
|
1
|
|
|
|
|
5
|
$self->width ( 20 ); |
16
|
1
|
|
|
|
|
4
|
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
|
|
|
|
|
4
|
my $subtype = $self->subtype; |
25
|
1
|
50
|
|
|
|
5
|
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
|
|
|
|
3
|
$args->{class} .= ' ifield'.($reveal ? ' reveal' : q()); |
37
|
1
|
|
|
|
|
3
|
$args->{size } = $self->width; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
10
|
my $html = $hacc->password_field( $args ); |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
55
|
$subtype =~ m{ verify }msx or return $html; |
42
|
1
|
|
|
|
|
3
|
$html .= $hacc->span( { class => 'prompt' }, |
43
|
|
|
|
|
|
|
$NBSP.$self->loc( 'and again' ).$NBSP ); |
44
|
1
|
|
|
|
|
20
|
$args->{name} =~ s{ 1 }{2}mx; $args->{id} =~ s{ 1 }{2}mx; |
|
1
|
|
|
|
|
2
|
|
45
|
1
|
|
|
|
|
3
|
$html .= $hacc->password_field( $args ); |
46
|
1
|
|
|
|
|
29
|
return $html; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|