diff --git a/packages/nocodb/src/models/User.ts b/packages/nocodb/src/models/User.ts index b2d300d508..447d7fed11 100644 --- a/packages/nocodb/src/models/User.ts +++ b/packages/nocodb/src/models/User.ts @@ -9,9 +9,8 @@ import { CacheScope, MetaTable, } from '~/utils/globals'; -import { Base, BaseUser } from '~/models'; +import { Base, BaseUser, UserRefreshToken } from '~/models'; import { sanitiseUserObj } from '~/utils'; -import UserRefreshToken from '~/models/UserRefreshToken'; export default class User implements UserType { id: string; diff --git a/packages/nocodb/src/models/UserRefreshToken.ts b/packages/nocodb/src/models/UserRefreshToken.ts index 69b699a3a3..5bd644d6bd 100644 --- a/packages/nocodb/src/models/UserRefreshToken.ts +++ b/packages/nocodb/src/models/UserRefreshToken.ts @@ -13,7 +13,7 @@ export default class UserRefreshToken { updated_at?: any; public static async insert( - syncLog: Partial, + userRefreshToken: Partial, ncMeta = Noco.ncMeta, ) { // clear old invalid tokens before inserting new one @@ -23,7 +23,7 @@ export default class UserRefreshToken { null, MetaTable.USER_REFRESH_TOKENS, { - fk_user_id: syncLog.fk_user_id, + fk_user_id: userRefreshToken.fk_user_id, }, { expires_at: { @@ -32,7 +32,7 @@ export default class UserRefreshToken { }, ); - const insertObj = extractProps(syncLog, [ + const insertObj = extractProps(userRefreshToken, [ 'fk_user_id', 'token', 'expires_at', diff --git a/packages/nocodb/src/models/index.ts b/packages/nocodb/src/models/index.ts index 2e62d9a533..ab22cdbdf1 100644 --- a/packages/nocodb/src/models/index.ts +++ b/packages/nocodb/src/models/index.ts @@ -40,3 +40,4 @@ export { default as View } from './View'; export { default as LinksColumn } from './LinksColumn'; export { default as Notification } from './Notification'; export { default as PresignedUrl } from './PresignedUrl'; +export { default as UserRefreshToken } from './UserRefreshToken'; diff --git a/packages/nocodb/src/services/users/users.service.ts b/packages/nocodb/src/services/users/users.service.ts index d504f3292c..44dec39945 100644 --- a/packages/nocodb/src/services/users/users.service.ts +++ b/packages/nocodb/src/services/users/users.service.ts @@ -21,13 +21,12 @@ import { validatePayload } from '~/helpers'; import { MetaService } from '~/meta/meta.service'; import { MetaTable } from '~/utils/globals'; import Noco from '~/Noco'; -import { Store, User } from '~/models'; +import { Store, User, UserRefreshToken } from '~/models'; import { randomTokenString } from '~/helpers/stringHelpers'; import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2'; import { NcError } from '~/helpers/catchError'; import { BasesService } from '~/services/bases.service'; import { extractProps } from '~/helpers/extractProps'; -import UserRefreshToken from '~/models/UserRefreshToken'; @Injectable() export class UsersService { @@ -381,11 +380,6 @@ export class UsersService { const refreshToken = randomTokenString(); - // await User.update(user.id, { - // email: user.email, - // refresh_token: refreshToken, - // }); - await UserRefreshToken.insert({ token: refreshToken, fk_user_id: user.id, @@ -584,8 +578,6 @@ export class UsersService { } await User.update(user.id, { - // refresh_token: refreshToken, - // email: user.email, token_version: user['token_version'], });