Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
8705e236
C
Cvat
项目概览
疯人忠
/
Cvat
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cvat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8705e236
编写于
11月 23, 2022
作者:
K
Kirill Lakhov
提交者:
GitHub
11月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added force logout on CVAT app start if token is missing (#5331)
上级
08dd27d9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
17 addition
and
19 deletion
+17
-19
CHANGELOG.md
CHANGELOG.md
+1
-0
cvat-core/package.json
cvat-core/package.json
+1
-1
cvat-core/src/server-proxy.ts
cvat-core/src/server-proxy.ts
+5
-1
cvat-ui/src/components/cvat-app.tsx
cvat-ui/src/components/cvat-app.tsx
+1
-1
cvat-ui/src/components/login-with-token/login-with-token.tsx
cvat-ui/src/components/login-with-token/login-with-token.tsx
+7
-12
tests/cypress/integration/actions_users/issue_1810_login_logout.js
...ress/integration/actions_users/issue_1810_login_logout.js
+2
-4
未找到文件。
CHANGELOG.md
浏览文件 @
8705e236
...
...
@@ -78,6 +78,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
(
<https://github.com/opencv/cvat/issues/4839>
)
-
Fixed job exporting (
<https://github.com/opencv/cvat/pull/5282>
)
-
Visibility and ignored information fail to be loaded (MOT dataset format) (
<https://github.com/opencv/cvat/pull/5270>
)
-
Added force logout on CVAT app start if token is missing (
<https://github.com/opencv/cvat/pull/5331>
)
-
Missed token with using social account authentication (
<https://github.com/opencv/cvat/pull/5344>
)
### Security
...
...
cvat-core/package.json
浏览文件 @
8705e236
{
"name"
:
"cvat-core"
,
"version"
:
"7.2.
0
"
,
"version"
:
"7.2.
1
"
,
"description"
:
"Part of Computer Vision Tool which presents an interface for client-side integration"
,
"main"
:
"src/api.ts"
,
"scripts"
:
{
...
...
cvat-core/src/server-proxy.ts
浏览文件 @
8705e236
...
...
@@ -456,7 +456,11 @@ class ServerProxy {
}
}
catch
(
serverError
)
{
if
(
serverError
.
code
===
401
)
{
removeToken
();
// In CVAT app we use two types of authentication,
// So here we are forcing user have both credential types
// First request will fail if session is expired, then we check
// for precense of token
await
logout
();
return
false
;
}
...
...
cvat-ui/src/components/cvat-app.tsx
浏览文件 @
8705e236
...
...
@@ -436,7 +436,7 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
<
Route
exact
path
=
'/auth/login'
component
=
{
LoginPageContainer
}
/>
<
Route
exact
path
=
'/auth/login-with-token/:
sessionId/:
token'
path
=
'/auth/login-with-token/:token'
component
=
{
LoginWithTokenComponent
}
/>
<
Route
exact
path
=
'/auth/password/reset'
component
=
{
ResetPasswordPageComponent
}
/>
...
...
cvat-ui/src/components/login-with-token/login-with-token.tsx
浏览文件 @
8705e236
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
Redirect
,
useParams
,
useLocation
}
from
'
react-router
'
;
import
{
useCookies
}
from
'
react-cookie
'
;
export
default
function
LoginWithTokenComponent
():
JSX
.
Element
{
const
location
=
useLocation
();
const
{
sessionId
,
token
}
=
useParams
<
{
sessionId
:
string
;
token
:
string
}
>
();
const
[
cookies
,
setCookie
]
=
useCookies
([
'
sessionid
'
,
'
csrftoken
'
]);
const
{
token
}
=
useParams
<
{
token
:
string
}
>
();
const
expires1y
=
new
Date
(
new
Date
().
setFullYear
(
new
Date
().
getFullYear
()
+
1
));
const
expires2w
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
+
13
));
const
search
=
new
URLSearchParams
(
location
.
search
);
setCookie
(
'
sessionid
'
,
sessionId
,
{
path
:
'
/
'
,
expires
:
expires2w
});
setCookie
(
'
csrftoken
'
,
token
,
{
path
:
'
/
'
,
expires
:
expires1y
});
useEffect
(
()
=>
()
=>
{
window
.
location
.
reload
();
()
=>
{
localStorage
.
setItem
(
'
token
'
,
token
);
return
()
=>
window
.
location
.
reload
();
},
[
cookies
.
sessionid
,
cookies
.
csrf
token
],
[
token
],
);
if
(
cookies
.
sessionid
&&
cookies
.
csrf
token
)
{
if
(
token
)
{
return
<
Redirect
to
=
{
search
.
get
(
'
next
'
)
||
'
/tasks
'
}
/>;
}
return
<></>;
...
...
tests/cypress/integration/actions_users/issue_1810_login_logout.js
浏览文件 @
8705e236
...
...
@@ -66,10 +66,8 @@ context('When clicking on the Logout button, get the user session closed.', () =
password
:
Cypress
.
env
(
'
password
'
),
},
}).
then
(
async
(
response
)
=>
{
const
cookies
=
await
response
.
headers
[
'
set-cookie
'
];
const
csrfToken
=
cookies
[
0
].
match
(
/csrftoken=
\w
+/
)[
0
].
replace
(
'
csrftoken=
'
,
''
);
const
sessionId
=
cookies
[
1
].
match
(
/sessionid=
\w
+/
)[
0
].
replace
(
'
sessionid=
'
,
''
);
cy
.
visit
(
`/login-with-token/
${
sessionId
}
/
${
csrfToken
}
?next=/tasks/
${
taskId
}
`
);
const
token
=
response
.
body
.
key
;
cy
.
visit
(
`/auth/login-with-token/
${
token
}
?next=/tasks/
${
taskId
}
`
);
cy
.
contains
(
'
.cvat-task-details-task-name
'
,
`
${
taskName
}
`
).
should
(
'
be.visible
'
);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录