gpt4 book ai didi

linux - revbeal 密码输入字段的 HTML 按钮

转载 作者:太空宇宙 更新时间:2023-11-04 05:56:35 24 4
gpt4 key购买 nike

我有一个有 7 列的表格。其中之一包含密码 (pw)。

我不想在我的网站上显示密码:我希望在表格中使用某种“单击展开”来显示密码。

以下是包含该表的脚本的一部分:

...

push @certlist, {
state => $cert[0],
'expire' => $date,
'subject' => $cert[5],
'cn' => $cn,
'ip' => $ccd_ips->{$cn},
'dl' => '',
're' => '',
'pw' => $password->{$cn}
};

...

return $q->table(
{ 'class' => 'certs' },
$q->Tr(
[
$q->th(
[ 'Status', 'Common Name', 'D', 'Password',
'Date', 'Subject', 'IP-Adress', 'R'
]
) . "\n",
map {
$q->td( { 'class' => $_->{'state'} }, $states{ $_->{'state'} } ) .
$q->td( [ @$_{qw(cn dl pw expire subject ip re)} ] ) . "\n"
} @certlist
]
)
) . "\n";

...

最佳答案

您应该只向包含密码的元素添加一个类,例如password-container。将初始内容设置为屏蔽。

即:

push @certlist, {
state => $cert[0],
'expire' => $date,
'subject' => $cert[5],
'cn' => $cn,
'ip' => $ccd_ips->{$cn},
'dl' => '',
're' => '',
'pw' => '*' x 8,
};

向页面添加一些 JavaScript,以便使用处理切换的 password-container 类为所有元素添加一个 onclick 处理程序。

return $q->table(
{ 'class' => 'certs' },
$q->Tr(
[
$q->th(
[ 'Status', 'Common Name', 'D', 'Password',
'Date', 'Subject', 'IP-Adress', 'R'
]
) . "\n",
map {
$q->td( { 'class' => $_->{'state'} }, $states{ $_->{'state'} } ) .
$q->td( [ @$_{qw(cn dl)} ]) .
$q->td( { 'class' => 'password_container' }, $_->{pw} ) .
$q->td( [ @$_{qw(expire subject ip re)} ] ) . "\n"
} @certlist
]
)
) . "\n";

或者一些类似的垃圾。

这再次显示了不使用 CGI.pm 生成 HTML 的值(value)。而是使用模板。这只是对 future 的建议,我假设您无法修复现有的代码库。

顺便说一句,这是来自 CGI.pm documentation 的相关位:

All HTML generation functions within CGI.pm are no longer being maintained. Any issues, bugs, or patches will be rejected unless they relate to fundamentally broken page rendering.

The rationale for this is that the HTML generation functions of CGI.pm are an obfuscation at best and a maintenance nightmare at worst. You should be using a template engine for better separation of concerns. See CGI::Alternatives for an example of using CGI.pm with the Template::Toolkit module.

These functions, and perldoc for them, are considered deprecated, they are no longer being maintained and no fixes or features for them will be accepted. They will, however, continue to exist in CGI.pm without any deprecation warnings ("soft" deprecation) so you can continue to use them if you really want to. All documentation for these functions has been moved to CGI::HTML::Functions.

关于linux - revbeal 密码输入字段的 HTML 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43782746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com