【发布时间】:2014-08-10 06:02:13
【问题描述】:
我想知道用户名在表单中提供的密码是否是用户在给定主机的系统上拥有的密码...我需要这个才能更改密码或返回错误消息给请求它的用户。特别希望在 Perl 中完成。
我有以下测试来查看用户是否存在,如果成功则匹配密码,如果成功则更改随请求提供的新密码我正在使用 JSON Rpc Dispatcher 为客户端提供服务。
if (getpwnam("$username")) {
# if ($currentpass == $sytempass) {}
return "User $username password is $newpass success!";
# else { return current password is incorrect}
}
else {
return "user $username never existed here";
}
【问题讨论】:
标签: linux unix encryption passwords perl