| HTML-Tested documentation | Contained in the HTML-Tested distribution. |
HTML::Tested::Value::PasswordBox - password input.
Provides <input type="password" /> html tag.
Overloads HTML::Tested::Value new function to handle check_mismatch
option.
Checks mismatch between two passwords during validate phase. The parameter should be the name of another password box.
E.g. check_mismatch => 'another_password'.
On failure produces mismatch result for validate function.
Boris Sukholitko (boriss@gmail.com)
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| HTML-Tested documentation | Contained in the HTML-Tested distribution. |
use strict; use warnings FATAL => 'all'; package HTML::Tested::Value::PasswordBox; use base 'HTML::Tested::Value';
sub new { my ($class, $parent, $name, %opts) = @_; my $other = $opts{check_mismatch}; push @{ $opts{constraints} }, [ mismatch => sub { my ($v, $root) = @_; return ($v // '') eq ($root->$other // ''); } ] if $other; return $class->SUPER::new($parent, $name, %opts); } sub value_to_string { my ($self, $name, $val) = @_; return <<ENDS; <input type="password" name="$name" id="$name" value="$val" /> ENDS } 1;