@nocobase/auth 1.7.0-alpha.1 → 1.7.0-beta.1

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.
@@ -45,7 +45,6 @@ export declare class BaseAuth extends Auth {
45
45
  }>;
46
46
  check(): ReturnType<Auth['check']>;
47
47
  validate(): Promise<Model>;
48
- signNewToken(userId: number): Promise<string>;
49
48
  signIn(): Promise<{
50
49
  user: Model<any, any>;
51
50
  token: string;
package/lib/base/auth.js CHANGED
@@ -240,23 +240,6 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
240
240
  async validate() {
241
241
  return null;
242
242
  }
243
- async signNewToken(userId) {
244
- const tokenInfo = await this.tokenController.add({ userId });
245
- const expiresIn = Math.floor((await this.tokenController.getConfig()).tokenExpirationTime / 1e3);
246
- const token = this.jwt.sign(
247
- {
248
- userId,
249
- temp: true,
250
- iat: Math.floor(tokenInfo.issuedTime / 1e3),
251
- signInTime: tokenInfo.signInTime
252
- },
253
- {
254
- jwtid: tokenInfo.jti,
255
- expiresIn
256
- }
257
- );
258
- return token;
259
- }
260
243
  async signIn() {
261
244
  let user;
262
245
  try {
@@ -272,7 +255,20 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
272
255
  code: import_auth.AuthErrorCode.NOT_EXIST_USER
273
256
  });
274
257
  }
275
- const token = await this.signNewToken(user.id);
258
+ const tokenInfo = await this.tokenController.add({ userId: user.id });
259
+ const expiresIn = Math.floor((await this.tokenController.getConfig()).tokenExpirationTime / 1e3);
260
+ const token = this.jwt.sign(
261
+ {
262
+ userId: user.id,
263
+ temp: true,
264
+ iat: Math.floor(tokenInfo.issuedTime / 1e3),
265
+ signInTime: tokenInfo.signInTime
266
+ },
267
+ {
268
+ jwtid: tokenInfo.jti,
269
+ expiresIn
270
+ }
271
+ );
276
272
  return {
277
273
  user,
278
274
  token
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@nocobase/auth",
3
- "version": "1.7.0-alpha.1",
3
+ "version": "1.7.0-beta.1",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
7
7
  "types": "./lib/index.d.ts",
8
8
  "dependencies": {
9
- "@nocobase/actions": "1.7.0-alpha.1",
10
- "@nocobase/cache": "1.7.0-alpha.1",
11
- "@nocobase/database": "1.7.0-alpha.1",
12
- "@nocobase/resourcer": "1.7.0-alpha.1",
13
- "@nocobase/utils": "1.7.0-alpha.1",
9
+ "@nocobase/actions": "1.7.0-beta.1",
10
+ "@nocobase/cache": "1.7.0-beta.1",
11
+ "@nocobase/database": "1.7.0-beta.1",
12
+ "@nocobase/resourcer": "1.7.0-beta.1",
13
+ "@nocobase/utils": "1.7.0-beta.1",
14
14
  "@types/jsonwebtoken": "^8.5.8",
15
15
  "jsonwebtoken": "^8.5.1"
16
16
  },
@@ -19,5 +19,5 @@
19
19
  "url": "git+https://github.com/nocobase/nocobase.git",
20
20
  "directory": "packages/auth"
21
21
  },
22
- "gitHead": "e411c9728b4d1f16b0beac16e40dd3499352b052"
22
+ "gitHead": "374a1bc60b3d55fd8b532a57c8fe0423eed1d11e"
23
23
  }