addInput('username', 'text', '用户名', '',
function($username, &$vdata) {
if (!validateUsername($username)) {
return '用户名不合法';
}
$vdata['user'] = queryUser($username);
if (!$vdata['user']) {
return '该用户不存在';
}
return '';
},
null
);
$forgot_form->handle = function(&$vdata) {
$user = $vdata['user'];
$password = $user["password"];
$sufs = base64url_encode($user['username'] . "." . md5($user['username'] . "+" . $password));
$url = HTML::url("/reset-password", array('params' => array('p' => $sufs)));
$html = <<
{$user['username']}您好,
您刚刚启用了UOJ密码找回功能,请进入下面的链接重设您的密码:
Universal Online Judge
EOD; $mailer = UOJMail::noreply(); $mailer->addAddress($user['email'], $user['username']); $mailer->Subject = "UOJ密码找回"; $mailer->msgHTML($html); if (!$mailer->send()) { error_log($mailer->ErrorInfo); becomeMsgPage('