Browse Source

修复后台修改会员密码的BUG
修复命令行创建插件名称的BUG

Karson 7 years ago
parent
commit
cd17735bef

+ 1 - 1
application/admin/command/Addon/stubs/info.stub

@@ -1,5 +1,5 @@
 name = {%name%}
 name = {%name%}
-title = 插件名称({%name%})
+title = 插件名称{%name%}
 intro = FastAdmin插件
 intro = FastAdmin插件
 author = yourname
 author = yourname
 website = http://www.fastadmin.net
 website = http://www.fastadmin.net

+ 2 - 1
application/admin/lang/zh-cn/user/user.php

@@ -28,5 +28,6 @@ return [
     'Createtime'     => '创建时间',
     'Createtime'     => '创建时间',
     'Updatetime'     => '更新时间',
     'Updatetime'     => '更新时间',
     'Token'          => 'Token',
     'Token'          => 'Token',
-    'Status'         => '状态'
+    'Status'         => '状态',
+    'Leave password blank if dont want to change' => '不修改密码请留空',
 ];
 ];

+ 8 - 5
application/admin/model/User.php

@@ -26,11 +26,14 @@ class User extends Model
         self::beforeUpdate(function ($row) {
         self::beforeUpdate(function ($row) {
             $changed = $row->getChangedData();
             $changed = $row->getChangedData();
             //如果有修改密码
             //如果有修改密码
-            if (isset($changed['password']))
-            {
-                $salt = \fast\Random::alnum();
-                $row->password = \app\common\library\Auth::instance()->getEncryptPassword($changed['password'], $salt);
-                $row->salt = $salt;
+            if (isset($changed['password'])) {
+                if ($changed['password']) {
+                    $salt = \fast\Random::alnum();
+                    $row->password = \app\common\library\Auth::instance()->getEncryptPassword($changed['password'], $salt);
+                    $row->salt = $salt;
+                } else {
+                    unset($row->password);
+                }
             }
             }
         });
         });
     }
     }

+ 1 - 0
application/index/lang/zh-cn/user.php

@@ -36,6 +36,7 @@ return [
     'Reset password'                        => '修改密码',
     'Reset password'                        => '修改密码',
     'Reset password by email'               => '通过邮箱',
     'Reset password by email'               => '通过邮箱',
     'Reset password by mobile'              => '通过手机重置',
     'Reset password by mobile'              => '通过手机重置',
+    'Reset password successful'             => '修改密码成功',
     'Account is locked'                     => '账户已经被锁定',
     'Account is locked'                     => '账户已经被锁定',
     'Password is incorrect'                 => '密码不正确',
     'Password is incorrect'                 => '密码不正确',
     'Account is incorrect'                  => '账户不正确',
     'Account is incorrect'                  => '账户不正确',