diff --git a/app/Models/User.php b/app/Models/User.php index e3506c2b..ea03f909 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -55,7 +55,7 @@ class User $this->model = UserModel::find($uid); } else { if (isset($info['email'])) { - $this->email = Utils::convertString($info['email']); + $this->email = e($info['email']); $this->model = UserModel::where('email', $this->email)->first(); } elseif (isset($info['username'])) { $player = PlayerModel::where('player_name', $info['username'])->first(); diff --git a/app/Services/Utils.php b/app/Services/Utils.php index 2c7f9d93..f4ebb83d 100644 --- a/app/Services/Utils.php +++ b/app/Services/Utils.php @@ -8,30 +8,6 @@ use Log; class Utils { - /** - * Simple SQL injection protection - * - * @param string $string - * @return string - */ - public static function convertString($string) - { - return addslashes(trim($string)); - } - - /** - * Get the value of key in an array if index exist - * - * @param string $key - * @param array $array - * @param string $default - * @return string - */ - public static function getValue($key, $array, $default = "") - { - return array_key_exists($key, $array) ? $array[$key] : $default; - } - /** * Rename uploaded file * diff --git a/setup/index.php b/setup/index.php index c54d1648..bdcaa9d6 100644 --- a/setup/index.php +++ b/setup/index.php @@ -41,7 +41,7 @@ switch ($step) { if (!check_password($password)) { redirect_to('index.php?step=2', '无效的密码。密码长度应该大于 8 并小于 16。'); - } else if (Utils::convertString($password) != $password) { + } else if (e($password) != $password) { redirect_to('index.php?step=2', '无效的密码。密码中包含了奇怪的字符。'); } } else {