From df7ee748c5d4af5960d83419f789190b2c0b4830 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 16 Jun 2023 11:18:28 +0800 Subject: [PATCH 1/4] fix(nc-gui): reset state token and user after signout --- packages/nc-gui/composables/useGlobal/actions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/composables/useGlobal/actions.ts b/packages/nc-gui/composables/useGlobal/actions.ts index 8b62ac9ead..34c840cda1 100644 --- a/packages/nc-gui/composables/useGlobal/actions.ts +++ b/packages/nc-gui/composables/useGlobal/actions.ts @@ -8,12 +8,14 @@ export function useGlobalActions(state: State): Actions { /** Sign out by deleting the token from localStorage */ const signOut: Actions['signOut'] = async () => { - state.token.value = null - state.user.value = null try { const nuxtApp = useNuxtApp() await nuxtApp.$api.auth.signout() - } catch {} + } catch { + } finally { + state.token.value = null + state.user.value = null + } } /** Sign in by setting the token in localStorage */ From 3408f642431db3dc2e3b6c3070017fd7203452bf Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 16 Jun 2023 11:18:58 +0800 Subject: [PATCH 2/4] fix(nocodb): add missing GlobalGuard on signout --- packages/nocodb/src/controllers/users/users.controller.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/controllers/users/users.controller.ts b/packages/nocodb/src/controllers/users/users.controller.ts index 0c8f153c78..ec94567d43 100644 --- a/packages/nocodb/src/controllers/users/users.controller.ts +++ b/packages/nocodb/src/controllers/users/users.controller.ts @@ -73,11 +73,15 @@ export class UsersController { res.json(this.usersService.login(req.user)); } + @UseGuards(GlobalGuard) @Post('/api/v1/auth/user/signout') @HttpCode(200) - async signout(@Request() req, @Response() res): Promise { + async signOut(@Request() req, @Response() res): Promise { + if (!(req as any).isAuthenticated()) { + NcError.forbidden('Not allowed'); + } res.json( - await this.usersService.signout({ + await this.usersService.signOut({ req, res, }), From 01b81f53bca3bd617a229e39a451dc32103d3d4a Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 16 Jun 2023 11:19:26 +0800 Subject: [PATCH 3/4] fix(nocodb): update user only if user id is given and reset token_version --- packages/nocodb/src/services/users/users.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/services/users/users.service.ts b/packages/nocodb/src/services/users/users.service.ts index 6d1305173b..39bbdee38b 100644 --- a/packages/nocodb/src/services/users/users.service.ts +++ b/packages/nocodb/src/services/users/users.service.ts @@ -493,13 +493,14 @@ export class UsersService { }; } - async signout(param: { res: any; req: any }) { + async signOut(param: { res: any; req: any }) { try { param.res.clearCookie('refresh_token'); const user = (param.req as any).user; - if (user) { + if (user?.id) { await User.update(user.id, { refresh_token: null, + token_version: null, }); } return { msg: 'Signed out successfully' }; From 813ceb281a35fa77e411668283910f1ff9018bed Mon Sep 17 00:00:00 2001 From: navi Date: Sat, 17 Jun 2023 16:56:42 +0100 Subject: [PATCH 4/4] New translations en.json (Thai) --- packages/nc-gui/lang/th.json | 156 +++++++++++++++++------------------ 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/packages/nc-gui/lang/th.json b/packages/nc-gui/lang/th.json index e66230abd7..e5303b52da 100644 --- a/packages/nc-gui/lang/th.json +++ b/packages/nc-gui/lang/th.json @@ -16,11 +16,11 @@ "cancel": "ยกเลิก", "submit": "ส่ง", "create": "สร้าง", - "duplicate": "Duplicate", + "duplicate": "คัดลอก", "insert": "แทรก", "delete": "ลบ", "update": "อัปเดต", - "rename": "การเปลี่ยนชื่อ", + "rename": "เปลี่ยนชื่อ", "reload": "โหลดใหม่", "reset": "รีเซ็ต", "install": "ติดตั้ง", @@ -57,32 +57,32 @@ "notification": "การแจ้ง", "reference": "อ้างอิง", "function": "การทำงาน", - "confirm": "Confirm", + "confirm": "ยืนยัน", "generate": "Generate", - "copy": "Copy", + "copy": "คัดลอก", "misc": "Miscellaneous", - "lock": "Lock", - "unlock": "Unlock", + "lock": "ล็อค", + "unlock": "ปลดล็อค", "credentials": "Credentials", - "help": "Help", - "questions": "Questions", - "reachOut": "Reach out here", - "betaNote": "This feature is currently in beta.", - "moreInfo": "More information can be found here", + "help": "ความช่วยเหลือ", + "questions": "คำถาม", + "reachOut": "แจ้งได้ที่นี่", + "betaNote": "ฟีเจอร์นี้อยู่ในเวอร์ชั่นเบต้า", + "moreInfo": "หาข้อมูลเพิ่มเติมได้ที่นี่", "logs": "Logs", "groupingField": "Grouping Field", - "insertAfter": "Insert After", - "insertBefore": "Insert Before", + "insertAfter": "แทรกหลัง", + "insertBefore": "แทรกก่อน", "hideField": "Hide Field", - "sortAsc": "Sort Ascending", - "sortDesc": "Sort Descending", + "sortAsc": "เรียงจากน้อยไปมาก", + "sortDesc": "เรียงจากมากไปน้อย", "geoDataField": "GeoData Field" }, "objects": { "project": "โครงการ", "projects": "โครงการ", "table": "ตาราง", - "tables": "โต๊ะ", + "tables": "ตาราง", "field": "สนาม", "fields": "ฟิลด์", "column": "คอลัมน์", @@ -200,18 +200,18 @@ "resetPassword": "รีเซ็ตรหัสผ่านของคุณ", "teamAndSettings": "Team & Settings", "apiDocs": "API Docs", - "importFromAirtable": "Import From Airtable", + "importFromAirtable": "นำเข้าจาก Airtable", "generateToken": "Generate Token", "APIsAndSupport": "APIs & Support", - "helpCenter": "Help center", + "helpCenter": "ศูนย์ช่วยเหลือ", "swaggerDocumentation": "Swagger Documentation", - "quickImportFrom": "Quick Import From", - "quickImport": "Quick Import", - "advancedSettings": "Advanced Settings", + "quickImportFrom": "นำเข้าด่วนจาก", + "quickImport": "นำเข้าด่วน", + "advancedSettings": "การตั้งค่าขั้นสูง", "codeSnippet": "Code Snippet", - "keyboardShortcut": "Keyboard Shortcuts", - "generateRandomName": "Generate Random Name", - "findRowByScanningCode": "Find row by scanning a QR or Barcode" + "keyboardShortcut": "คีย์ลัดแป้นพิมพ์", + "generateRandomName": "สุ่มชื่อ", + "findRowByScanningCode": "หาแถวโดยสแกน QR โค้ด" }, "labels": { "createdBy": "Created By", @@ -275,24 +275,24 @@ "columnName": "การผัน - ชื่อคอลัมน์" }, "community": { - "starUs1": "ดาว", + "starUs1": "ให้ดาว", "starUs2": "เราใน GitHub", "bookDemo": "จองการสาธิตฟรี", - "getAnswered": "รับคำถามของคุณตอบ", - "joinDiscord": "เข้าร่วมกับความไม่ลงรอยกัน", - "joinCommunity": "Join NocoDB Community", + "getAnswered": "มีคำถาม มาหาคำตอบที่นี่", + "joinDiscord": "เข้าร่วม Discord", + "joinCommunity": "เข้าร่วมคอมมูนิตี้ของ NocoDB", "joinReddit": "เข้าร่วม /r/NocoDB", "followNocodb": "ติดตาม NocoDB" }, "docReference": "เอกสารอ้างอิง", "selectUserRole": "เลือกบทบาทผู้ใช้", - "childTable": "โต๊ะเด็ก", + "childTable": "ตารางลูก", "childColumn": "คอลัมน์เด็ก", - "linkToAnotherRecord": "Link to another record", + "linkToAnotherRecord": "เชื่อมไปยังตารางอื่น", "onUpdate": "เมื่ออัปเดต", "onDelete": "ในการลบ", "account": "Account", - "language": "Language", + "language": "ภาษา", "primaryColor": "Primary Color", "accentColor": "Accent Color", "customTheme": "Custom Theme", @@ -309,8 +309,8 @@ "goToDashboard": "Go to Dashboard", "importing": "Importing", "flattenNested": "Flatten Nested", - "downloadAllowed": "Download allowed", - "weAreHiring": "We are Hiring!", + "downloadAllowed": "อนุญาตให้ดาวน์โหลด", + "weAreHiring": "เรากำลังรับสมัคร!", "primaryKey": "Primary key", "hasMany": "has many", "belongsTo": "belongs to", @@ -319,13 +319,13 @@ "commentsOnly": "Comments only", "documentation": "Documentation", "subscribeNewsletter": "Subscribe to our weekly newsletter", - "signUpWithGoogle": "Sign up with Google", - "signInWithGoogle": "Sign in with Google", - "agreeToTos": "By signing up, you agree to the Terms of Service", - "welcomeToNc": "Welcome to NocoDB!", - "inviteOnlySignup": "Allow signup only using invite url", - "nextRow": "Next Row", - "prevRow": "Previous Row" + "signUpWithGoogle": "สมัครใช้งานด้วย Google", + "signInWithGoogle": "ลงชื่อเข้าใช้ด้วย Google", + "agreeToTos": "เมื่อคุณสมัครใช้งานแล้ว ถือว่ายอมรับข้อตกลงการใช้งาน", + "welcomeToNc": "ยินดีต้อนรับสู่ NocoDB!", + "inviteOnlySignup": "อนุญาตให้สมัครได้ผ่านลิงก์เชิญชวนเท่านั้น", + "nextRow": "แถวต่อไป", + "prevRow": "แถวที่แล้ว" }, "activity": { "createProject": "สร้างโครงการ", @@ -370,14 +370,14 @@ "invite": "เชิญชวน", "inviteMore": "เชิญมากขึ้น", "inviteTeam": "เชิญทีม", - "inviteUser": "Invite User", + "inviteUser": "เชิญผู้ใช้", "inviteToken": "เชิญโทเค็น", "newUser": "ผู้ใช้ใหม่", "editUser": "แก้ไขผู้ใช้", "deleteUser": "ลบผู้ใช้จากโครงการ", "resendInvite": "ส่งอีเมลเชิญส่งอีเมลอีกครั้ง", "copyInviteURL": "Copy Invite URL", - "copyPasswordResetURL": "Copy password reset URL", + "copyPasswordResetURL": "คัดลอก URL รีเซ็ตรหัสผ่าน", "newRole": "บทบาทใหม่", "reloadRoles": "โหลดบทบาทใหม่", "nextPage": "หน้าต่อไป", @@ -385,22 +385,22 @@ "nextRecord": "บันทึกต่อไป", "previousRecord": "บันทึกก่อนหน้า", "copyApiURL": "คัดลอก URL API", - "createTable": "Create New Table", + "createTable": "สร้างตารางใหม่", "refreshTable": "รีเฟรชตาราง", - "renameTable": "Rename Table", - "deleteTable": "Delete Table", + "renameTable": "เปลี่ยนชื่อตาราง", + "deleteTable": "ลบตาราง", "addField": "เพิ่มฟิลด์ใหม่ลงในตารางนี้", - "setDisplay": "Set as Display value", + "setDisplay": "ตั้งเป็นค่าแสดง", "addRow": "เพิ่มแถวใหม่", "saveRow": "บันทึกแถว", - "saveAndExit": "Save & Exit", - "saveAndStay": "Save & Stay", + "saveAndExit": "บันทึกและออก", + "saveAndStay": "บันทึกและอยู่", "insertRow": "แทรกแถวใหม่", - "duplicateRow": "Duplicate Row", + "duplicateRow": "คัดลอกแถว", "deleteRow": "ลบแถว", "deleteSelectedRow": "ลบแถวที่เลือก", "importExcel": "นำเข้า Excel", - "importCSV": "Import CSV", + "importCSV": "นำเข้า CSV", "downloadCSV": "ดาวน์โหลดเป็น CSV", "downloadExcel": "ดาวน์โหลดเป็น XLSX", "uploadCSV": "อัปโหลด CSV", @@ -417,7 +417,7 @@ "listSharedView": "รายการมุมมองที่ใช้ร่วมกัน", "ListView": "รายการมุมมอง", "copyView": "คัดลอกมุมมอง", - "renameView": "เปลี่ยนชื่อดู", + "renameView": "เปลี่ยนชื่อมุมมอง", "deleteView": "ลบมุมมอง", "createGrid": "สร้างมุมมองกริด", "createGallery": "สร้างมุมมองแกลเลอรี่", @@ -429,10 +429,10 @@ "openTab": "เปิดแท็บใหม่", "iFrame": "คัดลอกรหัส HTML ที่ฝังได้", "addWebhook": "เพิ่ม webhook ใหม่", - "enableWebhook": "Enable Webhook", - "testWebhook": "Test Webhook", - "copyWebhook": "Copy Webhook", - "deleteWebhook": "Delete Webhook", + "enableWebhook": "เปิดการใช้งาน Webhook", + "testWebhook": "ทดสอบ Webhook", + "copyWebhook": "คัดลอก Webhook", + "deleteWebhook": "ลบ Webhook", "newToken": "เพิ่มโทเค็นใหม่", "exportZip": "ส่งออกซิป", "importZip": "zip นำเข้า", @@ -445,22 +445,22 @@ "editConnJson": "แก้ไขการเชื่อมต่อ JSON", "sponsorUs": "สปอนเซอร์สหรัฐฯ", "sendEmail": "ส่งอีเมล", - "addUserToProject": "Add user to project", + "addUserToProject": "เพิ่มผู้ใช้ในโครงการ", "getApiSnippet": "Get API Snippet", "clearCell": "Clear cell", "addFilterGroup": "Add Filter Group", - "linkRecord": "Link record", - "addNewRecord": "Add new record", + "linkRecord": "เชื่อมตาราง", + "addNewRecord": "เพิ่มตารางใหม่", "useConnectionUrl": "Use Connection URL", "toggleCommentsDraw": "Toggle comments draw", - "expandRecord": "Expand Record", - "deleteRecord": "Delete Record", + "expandRecord": "ขยายตาราง", + "deleteRecord": "ลบตาราง", "erd": { "showColumns": "Show Columns", "showPkAndFk": "Show Primary and Foreign Keys", "showSqlViews": "Show SQL Views", - "showMMTables": "Show Many to Many tables", - "showJunctionTableNames": "Show Junction Table Names" + "showMMTables": "แสดงตารางที่สัมพันธ์แบบกลุ่มต่อกลุ่ม", + "showJunctionTableNames": "แสดงตารางที่เชื่อมกัน 2 ตารางขึ้นไป" }, "kanban": { "collapseStack": "Collapse Stack", @@ -646,35 +646,35 @@ "credentials": "Where to find this?" }, "import": { - "clickOrDrag": "Click or drag file to this area to upload" + "clickOrDrag": "คลิกหรือลากไฟล์มาที่นี่เพื่ออัปโหลด" }, "metaDataRecreated": "Table metadata recreated successfully", "invalidCredentials": "Invalid credentials", "downloadingMoreFiles": "Downloading more files", - "copiedToClipboard": "Copied to clipboard", + "copiedToClipboard": "คัดลอกไปยังคลิปบอร์ดแล้ว", "requriedFieldsCantBeMoved": "Required field can't be moved", "updateNotAllowedWithoutPK": "Update not allowed for table which doesn't have primary key", - "autoIncFieldNotEditable": "Auto increment field is not editable", + "autoIncFieldNotEditable": "ช่องตารางที่เพิ่มลำดับได้เองแก้ไขไม่ได้", "editingPKnotSupported": "Editing primary key not supported", - "deletedCache": "Deleted cache successfully", - "cacheEmpty": "Cache is empty", - "exportedCache": "Exported Cache Successfully", + "deletedCache": "ลบแคชเรียบร้อยแล้ว", + "cacheEmpty": "ไม่พบแคช", + "exportedCache": "ส่งออกแคชเรียบร้อยแล้ว", "valueAlreadyInList": "This value is already in the list", "noColumnsToUpdate": "No columns to update", - "tableDeleted": "Deleted table successfully", + "tableDeleted": "ลบตารางสำเร็จ", "generatePublicShareableReadonlyBase": "Generate publicly shareable readonly base", "deleteViewConfirmation": "Are you sure you want to delete this view?", - "deleteTableConfirmation": "Do you want to delete the table", - "showM2mTables": "Show M2M Tables", + "deleteTableConfirmation": "คุณต้องการลบตารางหรือไม่", + "showM2mTables": "แสดงตารางที่สัมพันธ์แบบกลุ่มต่อกลุ่ม", "showM2mTablesDesc": "Many-to-many relation is supported via a junction table & is hidden by default. Enable this option to list all such tables along with existing tables.", - "showNullInCells": "Show NULL in Cells", - "showNullInCellsDesc": "Display 'NULL' tag in cells holding NULL value. This helps differentiate against cells holding EMPTY string.", - "showNullAndEmptyInFilter": "Show NULL and EMPTY in Filter", - "showNullAndEmptyInFilterDesc": "Enable 'additional' filters to differentiate fields containing NULL & Empty Strings. Default support for Blank treats both NULL & Empty strings alike.", + "showNullInCells": "แสดงค่า NULL ในช่อง", + "showNullInCellsDesc": "แสดงแท็ก 'NULL' ที่มีค่าเป็น NULL ในช่องตาราง ตัวเลือกนี้ช่วยแยกระหว่างช่องที่เป็น EMPTY ได้ชัดเจนขึ้น", + "showNullAndEmptyInFilter": "แสดงค่า NULL และ EMPTY ในตัวกรอง", + "showNullAndEmptyInFilterDesc": "เปิดใช้งานฟิลเตอร์ 'เพิ่มเติม' เพื่อแยกข้อมูลที่เป็น NULL และค่าตัวอักษรว่าง ระบบปกตินั้นจัดให้ NULL และ Empty มีค่าเหมือนกัน", "deleteKanbanStackConfirmation": "Deleting this stack will also remove the select option `{stackToBeDeleted}` from the `{groupingField}`. The records will move to the uncategorized stack.", "computedFieldEditWarning": "Computed field: contents are read-only. Use column edit menu to reconfigure", "computedFieldDeleteWarning": "Computed field: contents are read-only. Unable to clear content.", - "noMoreRecords": "No more records" + "noMoreRecords": "ไม่มีตารางใดๆ" }, "error": { "searchProject": "การค้นหาของคุณสำหรับ {search} ไม่พบผลลัพธ์", @@ -722,7 +722,7 @@ "deleteRowFailed": "Failed to delete row", "setFormDataFailed": "Failed to set form data", "formViewUpdateFailed": "Failed to update form view", - "tableNameRequired": "Table name is required", + "tableNameRequired": "จำเป็นต้องมีชื่อตาราง", "nameShouldStartWithAnAlphabetOr_": "Name should start with an alphabet or _", "followingCharactersAreNotAllowed": "Following characters are not allowed", "columnNameRequired": "Column name is required", @@ -764,7 +764,7 @@ "pluginUninstalled": "Plugin uninstalled successfully", "pluginSettingsSaved": "Plugin settings saved successfully", "pluginTested": "Successfully tested plugin settings", - "tableRenamed": "Table renamed successfully", + "tableRenamed": "เปลี่ยนชื่อตารางสำเร็จ", "viewDeleted": "View deleted successfully", "primaryColumnUpdated": "Successfully updated as primary column", "tableDataExported": "Successfully exported all table data",