Browse Source

refactor: move setRefreshtoken method to base class

pull/7569/head
Pranav C 10 months ago
parent
commit
f3826caa54
  1. 23
      packages/nocodb/src/services/users/users.service.ts

23
packages/nocodb/src/services/users/users.service.ts

@ -555,4 +555,27 @@ export class UsersService {
return base; return base;
} }
async setRefreshToken({ res, req }) {
const userId = req.user?.id;
if (!userId) return;
const user = await User.get(userId);
if (!user) return;
const refreshToken = randomTokenString();
if (!user['token_version']) {
user['token_version'] = randomTokenString();
}
await User.update(user.id, {
refresh_token: refreshToken,
email: user.email,
token_version: user['token_version'],
});
setTokenCookie(res, refreshToken);
}
} }

Loading…
Cancel
Save