diff --git a/class/Normal.php b/class/Normal.php index 016aa8d..cc4e0dd 100644 --- a/class/Normal.php +++ b/class/Normal.php @@ -88,6 +88,14 @@ private static function OutputMessage(int $gType, int $bCode) if ($bCode == 0) return 'emailFormat'; else if ($bCode == 1) return 405; else return "邮箱格式不符合"; + else if ($gType == 402) + if ($bCode == 0) return 'userFormat'; + else if ($bCode == 1) return 405; + else return "用户格式不符合"; + else if ($gType == 403) + if ($bCode == 0) return 'passwordIncorrect'; + else if ($bCode == 1) return 403; + else return "密码不正确"; else if ($gType == 500) if ($bCode == 0) return 'CaptchaEffective'; else if ($bCode == 1) return 200; @@ -96,6 +104,10 @@ private static function OutputMessage(int $gType, int $bCode) if ($bCode == 0) return 'AlReadyUser'; else if ($bCode == 1) return 403; else return "已经有这个用户"; + else if ($gType == 601) + if ($bCode == 0) return 'NoUser'; + else if ($bCode == 1) return 403; + else return "没有这个用户"; else return null; } diff --git a/mastermind/OutputMessage.md b/mastermind/OutputMessage.md index d7aeb74..a63ed9a 100644 --- a/mastermind/OutputMessage.md +++ b/mastermind/OutputMessage.md @@ -1,17 +1,19 @@ # OutputMessage 标准对照表 -| 序号 | output内容 | HTTP状态码 | 中文解释 | -|-----|------------------|---------|------------------------------| -| 100 | SessionError | 502 | 通讯密钥错误 | -| 200 | Success | 200 | 操作成功 | -| 201 | SuccessButEmail | 200 | 操作成功但邮件发送失败 | -| 300 | SqlInsertFail | 400 | 数据表内容插入失败 | -| 301 | SqlSelectFail | 400 | 数据表内容查询失败 | -| 310 | TokenTooShort | 502 | Token长度过短 | -| 311 | TokenTooLong | 502 | Token长度过长 | -| 400 | usernameFormat | 405 | 用户名格式不符合 (格式允许0-9,A-Z,a-z及_) | -| 401 | emailFormat | 405 | 邮箱格式不符合 | -| 500 | CaptchaEffective | 200 | 激活码任然有效 | -| 600 | AlReadyUser | 403 | 已经有这个用户 | -| | | | | -| | | | | \ No newline at end of file +| 序号 | output内容 | HTTP状态码 | 中文解释 | +|-----|-------------------|---------|------------------------------| +| 100 | SessionError | 502 | 通讯密钥错误 | +| 200 | Success | 200 | 操作成功 | +| 201 | SuccessButEmail | 200 | 操作成功但邮件发送失败 | +| 300 | SqlInsertFail | 400 | 数据表内容插入失败 | +| 301 | SqlSelectFail | 400 | 数据表内容查询失败 | +| 310 | TokenTooShort | 502 | Token长度过短 | +| 311 | TokenTooLong | 502 | Token长度过长 | +| 400 | usernameFormat | 405 | 用户名格式不符合 (格式允许0-9,A-Z,a-z及_) | +| 401 | emailFormat | 405 | 邮箱格式不符合 | +| 402 | userFormat | 405 | 用户格式不符合 | +| 403 | passwordIncorrect | 403 | 密码不正确 | +| 500 | CaptchaEffective | 200 | 激活码任然有效 | +| 600 | AlReadyUser | 403 | 已经有这个用户 | +| 601 | NoUser | 403 | 没有这个用户 | +| | | | | \ No newline at end of file diff --git a/public/api/auth/login/index.php b/public/api/auth/login/index.php new file mode 100644 index 0000000..a90d7f4 --- /dev/null +++ b/public/api/auth/login/index.php @@ -0,0 +1,49 @@ +password)) { + // 密码正确,操作结果 + if (Sql::UPDATE("UPDATE `index`.xf_user SET `login_time`='" . time() . "',`login_ip`='" . $_SERVER['REMOTE_ADDR'] . "' WHERE `username`='{$PostData['user']}' OR `email`='{$PostData['user']}'")) { + // 输出结果 + Normal::Output(200); + } else Normal::Output(300); + } else Normal::Output(403); + } else Normal::Output(601); + } else Normal::Output(402); +} else Normal::Output(100); \ No newline at end of file diff --git a/public/api/auth/register/index.php b/public/api/auth/register/index.php index ab95f01..136cf90 100644 --- a/public/api/auth/register/index.php +++ b/public/api/auth/register/index.php @@ -17,7 +17,7 @@ include dirname(__FILE__, 5) . "/Modules/API/header.php"; require dirname(__FILE__, 5) . "/class/Sql.php"; require dirname(__FILE__, 5) . "/class/Token.php"; -require dirname(__FILE__, 5) . "/class/Mailer/Mailer\SendMail.php"; +require dirname(__FILE__, 5) . "/class/Mailer/SendMail.php"; require dirname(__FILE__, 5) . "/class/Normal.php"; require dirname(__FILE__, 5) . "/class/Key.php";