From 797b8bb019c47b8df8f59aa21a672ddb7e51c5da Mon Sep 17 00:00:00 2001 From: Dream Hunter Date: Tue, 13 Aug 2024 01:38:20 +0800 Subject: [PATCH] fix: NO_LIMIT_SEND_ROLE no access token (#400) --- CHANGELOG.md | 2 +- worker/src/user_api/settings.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e848df..0e82e208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## main(v0.7.2) -- fix: worker 增加 `NO_LIMIT_SEND_ROLE` 配置, 有时加载失败的问题 +- fix: worker 增加 `NO_LIMIT_SEND_ROLE` 配置, 加载失败的问题 ## v0.7.1 diff --git a/worker/src/user_api/settings.ts b/worker/src/user_api/settings.ts index 9347657c..0c706fee 100644 --- a/worker/src/user_api/settings.ts +++ b/worker/src/user_api/settings.ts @@ -31,10 +31,10 @@ export default { && c.env.ADMIN_USER_ROLE === user_role?.role ); - const access_token = is_admin ? await Jwt.sign({ + const access_token = user_role?.role ? await Jwt.sign({ user_email: user.user_email, user_id: user.user_id, - user_role: user_role?.role, + user_role: user_role.role, iat: Math.floor(Date.now() / 1000), // 1 hour exp: Math.floor(Date.now() / 1000) + 3600,