diff --git a/application/common/model/Users.php b/application/common/model/Users.php index 1d98dd88..83c40dc7 100644 --- a/application/common/model/Users.php +++ b/application/common/model/Users.php @@ -51,10 +51,8 @@ class Users extends Model return sprintf("%.2f", $this->hasMany('Images', 'user_id', 'id')->sum('size')); } - public static function login($account, $password) + public static function login($account, $password, $field = 'email') { - $field = 'email'; - if (!$account) { throw new Exception('请输入账号'); } diff --git a/application/index/controller/Auth.php b/application/index/controller/Auth.php index 41cc386b..b9c74c79 100644 --- a/application/index/controller/Auth.php +++ b/application/index/controller/Auth.php @@ -14,11 +14,11 @@ use think\facade\Session; class Auth extends Base { - public function login($account = null, $password = null) + public function login($type = null, $account = null, $password = null) { if ($this->request->isPost()) { try { - Users::login($account, $password); + Users::login($account, $password, $type); } catch (Exception $e) { Session::flash('error', $e->getMessage()); return $this->fetch(); diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 911fb355..417d0140 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -197,7 +197,7 @@ class User extends Base $id = $this->request->post('id'); $name = $this->request->post('name'); - $validate = Validate::make(['name|名称' => 'require|max:25|chsDash']); + $validate = Validate::make(['name|别名' => 'require|max:60|chsDash']); if (!$validate->check(['name' => $name])) { throw new \Exception($validate->getError()); } diff --git a/application/index/view/auth/login.html b/application/index/view/auth/login.html index 6c2e5c96..855c49e2 100644 --- a/application/index/view/auth/login.html +++ b/application/index/view/auth/login.html @@ -16,9 +16,16 @@