Skip to content

Commit ebec623

Browse files
authored
1.9.1
解决变量名冲突导致部分php环境下重置密码时报错问题
1 parent 281a513 commit ebec623

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

Plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
require dirname(__FILE__) . '/PHPMailer/Exception.php';
2222

2323
/**
24-
* typecho 评论通过时发送邮件提醒,要求typecho1.2.0及以上<br>其他付费产品:<a href="https://typecho.fans/"target="_blank" rel="noopener noreferrer">https://typecho.fans/</a>
24+
* typecho评论邮件提醒插件/用户账号密码找回插件,要求typecho1.2及以上<br>其他付费产品:<a href="https://typecho.fans/"target="_blank" rel="noopener noreferrer">https://typecho.fans/</a>
2525
*
2626
* @package CommentNotifier
2727
* @author 泽泽社长
28-
* @version 1.9.0
28+
* @version 1.9.1
2929
* @link https://github.com/jrotty/CommentNotifier
3030
*/
3131

Widget.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,26 @@ public function doForgot()
7373
}
7474

7575
$db = Typecho_Db::get();
76-
$user = $db->fetchRow($db->select()->from('table.users')->where('mail = ?', $this->request->mail));
76+
$userRow = $db->fetchRow($db->select()->from('table.users')->where('mail = ?', $this->request->mail));
7777

78-
if (empty($user)) {
78+
if (empty($userRow)) {
7979
// 返回没有该用户
8080
$this->notice->set(_t('该邮箱还没有注册'), 'error');
8181
return false;
8282
}
8383

8484
/* 生成重置密码地址 */
85-
$hashString = $user['name'] . $user['mail'] . $user['password'];
85+
$hashString = $userRow['name'] . $userRow['mail'] . $userRow['password'];
8686
$hashValidate = Typecho_Common::hash($hashString);
87-
$token = base64_encode($user['uid'] . '.' . $hashValidate . '.' . $this->options->gmtTime);
87+
$token = base64_encode($userRow['uid'] . '.' . $hashValidate . '.' . $this->options->gmtTime);
8888
$url = Typecho_Common::url('/password/reset?token=' . $token, $this->options->index);
8989

9090

9191
/* 发送重置密码地址 */
92-
$param['to'] = $user['mail']; // 收件地址
93-
$param['fromName'] = $user['name']; // 收件人名称
92+
$param['to'] = $userRow['mail']; // 收件地址
93+
$param['fromName'] = $userRow['name']; // 收件人名称
9494
$param['subject'] = '密码重置' . date('Y-m-d H:i:s');// 邮件标题
95-
$param['html'] = '<p>' . $user['name'] . ' 您好,您申请了重置登录密码。</p>'
95+
$param['html'] = '<p>' . $userRow['name'] . ' 您好,您申请了重置登录密码。</p>'
9696
. '<br><p>请在 1 小时内点击此链接以完成重置 <a href="' . $url . '">' . $url . '</a></p>'
9797
. '<br><p>如非本人操作请忽略本条消息!</p>'; // 邮件内容
9898
CommentNotifier_Plugin::send($param);
@@ -123,9 +123,9 @@ public function doReset()
123123
}
124124

125125
$db = Typecho_Db::get();
126-
$user = $db->fetchRow($db->select()->from('table.users')->where('uid = ?', $uid));
126+
$userRow = $db->fetchRow($db->select()->from('table.users')->where('uid = ?', $uid));
127127

128-
$hashString = $user['name'] . $user['mail'] . $user['password'];
128+
$hashString = $userRow['name'] . $userRow['mail'] . $userRow['password'];
129129
$hashValidate = Typecho_Common::hashValidate($hashString, $hashValidate);
130130

131131
if (!$hashValidate) {
@@ -149,7 +149,7 @@ public function doReset()
149149

150150
$update = $db->query($db->update('table.users')
151151
->rows(array('password' => $password))
152-
->where('uid = ?', $user['uid']));
152+
->where('uid = ?', $userRow['uid']));
153153

154154
if (!$update) {
155155
$this->notice->set(_t('重置密码失败'), 'error');

0 commit comments

Comments
 (0)