@gingkoo/base-server 0.4.16 → 0.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  var express = require('express');
3
3
  const nodemailer = require('nodemailer');
4
4
  const bcrypt = require('bcryptjs');
5
- const { request } = require('@gingkoo/node-tools');
5
+ const { request, RequestError } = require('@gingkoo/node-tools');
6
6
  const config = require('../config');
7
7
  const { userlog } = require('../../backend/common/logger');
8
8
  const jwt = require('../utils/jwt');
@@ -57,11 +57,11 @@ router.post('/login', async (req, res) => {
57
57
  Authorization: `Bearer ${config.oauth.account_token}`,
58
58
  },
59
59
  });
60
- } catch (err) {}
61
-
62
- if (resp.isError) {
63
- userlog.error(`用户:${userId} lapd 登录失败`);
64
- return res.sendErr('账号或密码错误');
60
+ } catch (err) {
61
+ if (err instanceof RequestError && err.status == '401') {
62
+ return res.sendErr('账号或密码错误');
63
+ }
64
+ return res.sendErr(err.message);
65
65
  }
66
66
 
67
67
  let { access_token, expires_in, token_type, user_id } = resp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/base-server",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "author": "",
23
23
  "license": "ISC",
24
24
  "dependencies": {
25
- "@gingkoo/node-tools": "1.2.6",
25
+ "@gingkoo/node-tools": "1.2.7-alpha.4",
26
26
  "axios": "1.9.0",
27
27
  "bcryptjs": "^2.4.3",
28
28
  "chalk": "^4.1.2",