From 486e6d6fc78e86c152667aefc4659d4d41da01db Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Mon, 28 Sep 2020 09:17:16 +0200 Subject: [PATCH 1/9] Allow to login into UI with token from api/v1/auth/login --- cvat-ui/package-lock.json | 50 +++++++++++++++++++++++++++-- cvat-ui/package.json | 1 + cvat-ui/src/components/cvat-app.tsx | 2 ++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index eec8d5c99186..b6577d032c53 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -985,6 +985,11 @@ "resolved": "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz", "integrity": "sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==" }, + "@types/cookie": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", + "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" + }, "@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -2964,8 +2969,7 @@ "cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "dev": true + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" }, "cookie-signature": { "version": "1.0.6", @@ -13996,6 +14000,15 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -16171,6 +16184,12 @@ "flat-cache": "^2.0.1" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -16317,6 +16336,8 @@ "integrity": "sha512-Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q==", "optional": true, "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1", "node-pre-gyp": "*" }, "dependencies": { @@ -18631,6 +18652,12 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, + "nan": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", + "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -27597,6 +27624,16 @@ "tinycolor2": "^1.4.1" } }, + "react-cookie": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.0.3.tgz", + "integrity": "sha512-cmi6IpdVgTSvjqssqIEvo779Gfqc4uPGHRrKMEdHcqkmGtPmxolGfsyKj95bhdLEKqMdbX8MLBCwezlnhkHK0g==", + "requires": { + "@types/hoist-non-react-statics": "^3.0.1", + "hoist-non-react-statics": "^3.0.0", + "universal-cookie": "^4.0.0" + } + }, "react-dom": { "version": "16.11.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.11.0.tgz", @@ -29986,6 +30023,15 @@ "imurmurhash": "^0.1.4" } }, + "universal-cookie": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", + "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", + "requires": { + "@types/cookie": "^0.3.3", + "cookie": "^0.4.0" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/cvat-ui/package.json b/cvat-ui/package.json index b15924fdce52..9f11dd8dac9e 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -67,6 +67,7 @@ "prop-types": "^15.7.2", "react": "^16.9.0", "react-color": "^2.18.1", + "react-cookie": "^4.0.3", "react-dom": "^16.9.0", "react-hotkeys": "^2.0.0", "react-redux": "^7.1.1", diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index cd928f8b8345..5a83552c8db2 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -15,6 +15,7 @@ import Text from 'antd/lib/typography/Text'; import notification from 'antd/lib/notification'; import GlobalErrorBoundary from 'components/global-error-boundary/global-error-boundary'; +import LoginWithTokenComponent from './login-with-token/login-with-token'; import ShorcutsDialog from 'components/shortcuts-dialog/shortcuts-dialog'; import TasksPageContainer from 'containers/tasks-page/tasks-page'; import CreateTaskPageContainer from 'containers/create-task-page/create-task-page'; @@ -337,6 +338,7 @@ class CVATApplication extends React.PureComponent + From c0a129f2a96e92eebc35f2d1cd2d93667727557a Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Mon, 28 Sep 2020 09:33:59 +0200 Subject: [PATCH 2/9] Update changelog --- CHANGELOG.md | 1 + .../login-with-token/login-with-token.tsx | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 cvat-ui/src/components/login-with-token/login-with-token.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e9db7abc8c..bd44caeed33b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.2.0] - Unreleased ### Added +- Allow to login into CVAT-UI with token from api/v1/auth/login () - Added password reset functionality () - Ability to work with data on the fly (https://github.com/opencv/cvat/pull/2007) - Annotation in process outline color wheel () diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx new file mode 100644 index 000000000000..1c76c9689e98 --- /dev/null +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React from 'react'; +import {Redirect, useParams} from "react-router"; +import {useCookies } from "react-cookie"; + +export default function LoginWithTokenComponent(){ + const { sessionId, token } = useParams() + const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']) + const expires = new Date(new Date().setFullYear(new Date().getFullYear() + 1)) + setCookie('sessionid', sessionId, {path: '/', expires }) + setCookie('csrftoken', token, {path: '/', expires}) + + if ( cookies['sessionid'] && cookies['csrftoken']) { + window.location.reload(); + + } + return(<>); + +}; From 01db6f0c5d7235a3698d7485f53d5fe153cdadcf Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Mon, 28 Sep 2020 11:20:47 +0200 Subject: [PATCH 3/9] style --- CHANGELOG.md | 2 +- cvat-ui/src/components/login-with-token/login-with-token.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd44caeed33b..3ba79f74255b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.2.0] - Unreleased ### Added -- Allow to login into CVAT-UI with token from api/v1/auth/login () +- Ability to login into CVAT-UI with token from api/v1/auth/login () - Added password reset functionality () - Ability to work with data on the fly (https://github.com/opencv/cvat/pull/2007) - Annotation in process outline color wheel () diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx index 1c76c9689e98..5611e1c2fa59 100644 --- a/cvat-ui/src/components/login-with-token/login-with-token.tsx +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -18,5 +18,4 @@ export default function LoginWithTokenComponent(){ } return(<>); - }; From 602d4090dd11047670d68a90c6912dbbbc5d37a2 Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Thu, 8 Oct 2020 12:35:33 +0200 Subject: [PATCH 4/9] Rev --- .gitignore | 1 - cvat-ui/package.json | 2 +- .../login-with-token/login-with-token.tsx | 13 ++++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 74d17ab209a4..cbe91f69a9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ __pycache__ *.pyc ._* .coverage -venv/ # Ignore development npm files node_modules diff --git a/cvat-ui/package.json b/cvat-ui/package.json index a3c91809c424..f214d6d4938c 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.9.10", + "version": "1.9.11", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx index 5611e1c2fa59..e9327877126f 100644 --- a/cvat-ui/src/components/login-with-token/login-with-token.tsx +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -3,15 +3,18 @@ // SPDX-License-Identifier: MIT import React from 'react'; -import {Redirect, useParams} from "react-router"; -import {useCookies } from "react-cookie"; +import { Redirect, useParams } from 'react-router'; +import { useCookies } from 'react-cookie'; export default function LoginWithTokenComponent(){ const { sessionId, token } = useParams() const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']) - const expires = new Date(new Date().setFullYear(new Date().getFullYear() + 1)) - setCookie('sessionid', sessionId, {path: '/', expires }) - setCookie('csrftoken', token, {path: '/', expires}) + + const expires1y = new Date(new Date().setFullYear(new Date().getFullYear() + 1)) + const expires2w = new Date(new Date().setDate(new Date().getDate() + 13)) + + setCookie('sessionid', sessionId, {path: '/', expires: expires2w }) + setCookie('csrftoken', token, {path: '/', expires: expires1y}) if ( cookies['sessionid'] && cookies['csrftoken']) { window.location.reload(); From 5748e9bdc41a4321c785b054ea1d9b12ef656df6 Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Fri, 9 Oct 2020 15:32:23 +0200 Subject: [PATCH 5/9] Rev: Fixed style. Added cva-ui version to UI. Fixed endless redirection with wrong tokens --- cvat-ui/package-lock.json | 6 +++--- .../login-with-token/login-with-token.tsx | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index c60d640e4b04..9fa9318cc97e 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.9.10", + "version": "1.9.11", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3428,7 +3428,7 @@ "version": "file:../cvat-canvas", "requires": { "svg.draggable.js": "2.2.2", - "svg.draw.js": "^2.0.3", + "svg.draw.js": "^2.0.4", "svg.js": "2.7.1", "svg.resize.js": "1.4.3", "svg.select.js": "3.0.1" @@ -14692,7 +14692,7 @@ "version": "file:../cvat-data", "requires": { "async-mutex": "^0.1.4", - "jszip": "3.1.5" + "jszip": "3.5.0" }, "dependencies": { "ajv": { diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx index e9327877126f..d589539d4521 100644 --- a/cvat-ui/src/components/login-with-token/login-with-token.tsx +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -2,23 +2,25 @@ // // SPDX-License-Identifier: MIT -import React from 'react'; +import React, { useEffect } from 'react'; import { Redirect, useParams } from 'react-router'; import { useCookies } from 'react-cookie'; export default function LoginWithTokenComponent(){ - const { sessionId, token } = useParams() - const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']) + const { sessionId, token } = useParams(); + const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']); - const expires1y = new Date(new Date().setFullYear(new Date().getFullYear() + 1)) - const expires2w = new Date(new Date().setDate(new Date().getDate() + 13)) + const expires1y = new Date(new Date().setFullYear(new Date().getFullYear() + 1)); + const expires2w = new Date(new Date().setDate(new Date().getDate() + 13)); - setCookie('sessionid', sessionId, {path: '/', expires: expires2w }) - setCookie('csrftoken', token, {path: '/', expires: expires1y}) + setCookie('sessionid', sessionId, {path: '/', expires: expires2w }); + setCookie('csrftoken', token, {path: '/', expires: expires1y}); + + useEffect(() => {return () => {window.location.reload()}; + }, [cookies['sessionid'], cookies['csrftoken']]); if ( cookies['sessionid'] && cookies['csrftoken']) { - window.location.reload(); - + return(); } return(<>); }; From 161f3e3fba757a7c1bb3d0cd118b643d2d743ea7 Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Fri, 9 Oct 2020 16:08:34 +0200 Subject: [PATCH 6/9] eslint --- cvat-core/package-lock.json | 2 +- cvat-ui/package-lock.json | 73 ++++++++++--------- .../login-with-token/login-with-token.tsx | 19 ++--- 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/cvat-core/package-lock.json b/cvat-core/package-lock.json index 0da9bfcfd463..ca352e7362b5 100644 --- a/cvat-core/package-lock.json +++ b/cvat-core/package-lock.json @@ -2710,7 +2710,7 @@ "version": "file:../cvat-data", "requires": { "async-mutex": "^0.1.4", - "jszip": "3.1.5" + "jszip": "3.5.0" }, "dependencies": { "@babel/cli": { diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 9fa9318cc97e..59739ce05a1a 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -11262,9 +11262,9 @@ } }, "svg.draw.js": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/svg.draw.js/-/svg.draw.js-2.0.3.tgz", - "integrity": "sha512-GGK7vBzwdEgr5fJUupqDqYPhQBXxrtBd4CcrgqAt7S4/5REmF6JTSuITeAgfVlfXftOO90t5OqLOtJ4IEEUFVw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/svg.draw.js/-/svg.draw.js-2.0.4.tgz", + "integrity": "sha512-NMbecB0vg11AP76B0aLfI2cX7g9WurPM8x3yKxuJ9feM1vkI1GVjWZZjWpo3mkEzB1UJ8pKngaPaUCIOGi8uUA==", "requires": { "svg.js": "2.x.x" } @@ -14721,11 +14721,6 @@ "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" }, - "core-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", - "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=" - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -14736,11 +14731,6 @@ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" }, - "es6-promise": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", - "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=" - }, "fast-deep-equal": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", @@ -14780,21 +14770,20 @@ } }, "jszip": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", - "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz", + "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==", "requires": { - "core-js": "~2.3.0", - "es6-promise": "~3.0.2", - "lie": "~3.1.0", + "lie": "~3.3.0", "pako": "~1.0.2", - "readable-stream": "~2.0.6" + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" } }, "lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", "requires": { "immediate": "~3.0.5" } @@ -14820,9 +14809,9 @@ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "punycode": { "version": "2.1.1", @@ -14830,18 +14819,24 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "requires": { "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "inherits": "~2.0.3", "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "schema-utils": { "version": "0.4.7", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", @@ -14851,10 +14846,18 @@ "ajv-keywords": "^3.1.0" } }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } }, "uri-js": { "version": "4.2.2", diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx index d589539d4521..f3c3743db359 100644 --- a/cvat-ui/src/components/login-with-token/login-with-token.tsx +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -6,21 +6,22 @@ import React, { useEffect } from 'react'; import { Redirect, useParams } from 'react-router'; import { useCookies } from 'react-cookie'; -export default function LoginWithTokenComponent(){ +export default function LoginWithTokenComponent() { const { sessionId, token } = useParams(); const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']); const expires1y = new Date(new Date().setFullYear(new Date().getFullYear() + 1)); const expires2w = new Date(new Date().setDate(new Date().getDate() + 13)); - setCookie('sessionid', sessionId, {path: '/', expires: expires2w }); - setCookie('csrftoken', token, {path: '/', expires: expires1y}); + setCookie('sessionid', sessionId, { path: '/', expires: expires2w }); + setCookie('csrftoken', token, { path: '/', expires: expires1y }); - useEffect(() => {return () => {window.location.reload()}; - }, [cookies['sessionid'], cookies['csrftoken']]); + useEffect(() => () => { + window.location.reload(); + }, [cookies.sessionid, cookies.csrftoken]); - if ( cookies['sessionid'] && cookies['csrftoken']) { - return(); + if (cookies.sessionid && cookies.csrftoken) { + return (); } - return(<>); -}; + return (<>); +} From 6ddf12066be3a231c1eea64a5dc41e6b893dae74 Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Fri, 9 Oct 2020 16:12:26 +0200 Subject: [PATCH 7/9] revert cvat-core/package-lock.json --- cvat-core/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-core/package-lock.json b/cvat-core/package-lock.json index ca352e7362b5..0da9bfcfd463 100644 --- a/cvat-core/package-lock.json +++ b/cvat-core/package-lock.json @@ -2710,7 +2710,7 @@ "version": "file:../cvat-data", "requires": { "async-mutex": "^0.1.4", - "jszip": "3.5.0" + "jszip": "3.1.5" }, "dependencies": { "@babel/cli": { From 4b3e017d0713b9054d8c621d7a388487a63cb236 Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Fri, 9 Oct 2020 16:38:38 +0200 Subject: [PATCH 8/9] Rev: Fixed import order and return type --- cvat-ui/src/components/cvat-app.tsx | 3 +-- cvat-ui/src/components/login-with-token/login-with-token.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index 096063a144b0..f134dd20d719 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -10,11 +10,11 @@ import notification from 'antd/lib/notification'; import Spin from 'antd/lib/spin'; import Text from 'antd/lib/typography/Text'; import GlobalErrorBoundary from 'components/global-error-boundary/global-error-boundary'; -import LoginWithTokenComponent from './login-with-token/login-with-token'; import Header from 'components/header/header'; import ResetPasswordPageConfirmComponent from 'components/reset-password-confirm-page/reset-password-confirm-page'; import ResetPasswordPageComponent from 'components/reset-password-page/reset-password-page'; import ShorcutsDialog from 'components/shortcuts-dialog/shortcuts-dialog'; +import LoginWithTokenComponent from 'components/login-with-token/login-with-token'; import AnnotationPageContainer from 'containers/annotation-page/annotation-page'; import CreateTaskPageContainer from 'containers/create-task-page/create-task-page'; import LoginPageContainer from 'containers/login-page/login-page'; @@ -33,7 +33,6 @@ import showPlatformNotification, { platformInfo, stopNotifications } from 'utils import '../styles.scss'; - interface CVATAppProps { loadFormats: () => void; loadUsers: () => void; diff --git a/cvat-ui/src/components/login-with-token/login-with-token.tsx b/cvat-ui/src/components/login-with-token/login-with-token.tsx index f3c3743db359..5c289ec57bf0 100644 --- a/cvat-ui/src/components/login-with-token/login-with-token.tsx +++ b/cvat-ui/src/components/login-with-token/login-with-token.tsx @@ -6,7 +6,7 @@ import React, { useEffect } from 'react'; import { Redirect, useParams } from 'react-router'; import { useCookies } from 'react-cookie'; -export default function LoginWithTokenComponent() { +export default function LoginWithTokenComponent(): JSX.Element { const { sessionId, token } = useParams(); const [cookies, setCookie] = useCookies(['sessionid', 'csrftoken']); From 24ceb3dc2e8545958866cd814447fdedc7cd745c Mon Sep 17 00:00:00 2001 From: Tomasz Dowgielewicz Date: Fri, 9 Oct 2020 16:53:48 +0200 Subject: [PATCH 9/9] Revert bindings --- cvat/apps/dataset_manager/bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat/apps/dataset_manager/bindings.py b/cvat/apps/dataset_manager/bindings.py index 331838de0465..02d4eaabdf13 100644 --- a/cvat/apps/dataset_manager/bindings.py +++ b/cvat/apps/dataset_manager/bindings.py @@ -13,7 +13,7 @@ from cvat.apps.engine.frame_provider import FrameProvider from cvat.apps.engine.models import AttributeType, ShapeType from datumaro.util import cast -# from datumaro.util.image import ByteImage, Image +from datumaro.util.image import ByteImage, Image from .annotation import AnnotationManager, TrackManager