From 026cb3de8b1a6ca52901cfe893a6a3f6c2494e43 Mon Sep 17 00:00:00 2001 From: joyqi Date: Thu, 21 Nov 2013 09:50:21 +0800 Subject: [PATCH] fixed #77 --- var/Widget/Abstract/Contents.php | 6 +++--- var/Widget/User.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/var/Widget/Abstract/Contents.php b/var/Widget/Abstract/Contents.php index e4383dbb..891c4606 100644 --- a/var/Widget/Abstract/Contents.php +++ b/var/Widget/Abstract/Contents.php @@ -512,12 +512,12 @@ class Widget_Abstract_Contents extends Widget_Abstract $value['slug'] = $tmpSlug; $value['category'] = $tmpCategory; - + /** 处理密码保护流程 */ if (!empty($value['password']) && $value['password'] != $this->request->protectPassword && - ($value['authorId'] != $this->user->uid - || !$this->user->pass('editor', true))) { + $value['authorId'] != $this->user->uid && + !$this->user->pass('editor', true)) { $value['hidden'] = true; /** 抛出错误 */ diff --git a/var/Widget/User.php b/var/Widget/User.php index 55c3541b..12ae5341 100644 --- a/var/Widget/User.php +++ b/var/Widget/User.php @@ -121,7 +121,7 @@ class Widget_User extends Typecho_Widget /** 开始验证用户 **/ $user = $this->db->fetchRow($this->db->select() ->from('table.users') - ->where('name = ?', $name) + ->where((strpos($name, '@') ? 'mail' : 'name') . ' = ?', $name) ->limit(1)); $hashValidate = $this->pluginHandle()->trigger($hashPluggable)->hashValidate($password, $user['password']);