Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
c18d6927
Commit
c18d6927
authored
Jun 26, 2025
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update user session table
parent
1fffc41f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
35 deletions
+1
-35
auth_service.go
server/router/api/v1/auth_service.go
+0
-10
Navigation.tsx
web/src/components/Navigation.tsx
+1
-1
UserSessionsSection.tsx
web/src/components/Settings/UserSessionsSection.tsx
+0
-24
No files found.
server/router/api/v1/auth_service.go
View file @
c18d6927
...
@@ -229,16 +229,6 @@ func (s *APIV1Service) DeleteSession(ctx context.Context, _ *v1pb.DeleteSessionR
...
@@ -229,16 +229,6 @@ func (s *APIV1Service) DeleteSession(ctx context.Context, _ *v1pb.DeleteSessionR
}
}
}
}
// Check if we have an access token (from header-based auth)
if
accessToken
,
ok
:=
ctx
.
Value
(
accessTokenContextKey
)
.
(
string
);
ok
&&
accessToken
!=
""
{
// Delete the access token from the store
if
_
,
err
:=
s
.
DeleteUserAccessToken
(
ctx
,
&
v1pb
.
DeleteUserAccessTokenRequest
{
Name
:
fmt
.
Sprintf
(
"%s%d/accessTokens/%s"
,
UserNamePrefix
,
user
.
ID
,
accessToken
),
});
err
!=
nil
{
slog
.
Error
(
"failed to delete access token"
,
"error"
,
err
)
}
}
if
err
:=
s
.
clearAuthCookies
(
ctx
);
err
!=
nil
{
if
err
:=
s
.
clearAuthCookies
(
ctx
);
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to clear auth cookies, error: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to clear auth cookies, error: %v"
,
err
)
}
}
...
...
web/src/components/Navigation.tsx
View file @
c18d6927
...
@@ -71,7 +71,7 @@ const Navigation = observer((props: Props) => {
...
@@ -71,7 +71,7 @@ const Navigation = observer((props: Props) => {
)
}
)
}
>
>
<
div
className=
"w-full px-1 py-1 flex flex-col justify-start items-start space-y-2 overflow-auto overflow-x-hidden hide-scrollbar shrink"
>
<
div
className=
"w-full px-1 py-1 flex flex-col justify-start items-start space-y-2 overflow-auto overflow-x-hidden hide-scrollbar shrink"
>
<
NavLink
className=
"mb-
2
cursor-default"
to=
{
currentUser
?
Routes
.
ROOT
:
Routes
.
EXPLORE
}
>
<
NavLink
className=
"mb-
3
cursor-default"
to=
{
currentUser
?
Routes
.
ROOT
:
Routes
.
EXPLORE
}
>
<
BrandBanner
collapsed=
{
collapsed
}
/>
<
BrandBanner
collapsed=
{
collapsed
}
/>
</
NavLink
>
</
NavLink
>
{
navLinks
.
map
((
navLink
)
=>
(
{
navLinks
.
map
((
navLink
)
=>
(
...
...
web/src/components/Settings/UserSessionsSection.tsx
View file @
c18d6927
...
@@ -60,18 +60,6 @@ const UserSessionsSection = () => {
...
@@ -60,18 +60,6 @@ const UserSessionsSection = () => {
return
parts
.
length
>
0
?
parts
.
join
(
" • "
)
:
"Unknown Device"
;
return
parts
.
length
>
0
?
parts
.
join
(
" • "
)
:
"Unknown Device"
;
};
};
const
getSessionExpirationDate
=
(
session
:
UserSession
)
=>
{
if
(
!
session
.
lastAccessedTime
)
return
null
;
// Calculate expiration as last_accessed_time + 2 weeks (14 days)
const
expirationDate
=
new
Date
(
session
.
lastAccessedTime
.
getTime
()
+
14
*
24
*
60
*
60
*
1000
);
return
expirationDate
;
};
const
isSessionExpired
=
(
session
:
UserSession
)
=>
{
const
expirationDate
=
getSessionExpirationDate
(
session
);
return
expirationDate
?
expirationDate
<
new
Date
()
:
false
;
};
const
isCurrentSession
=
(
session
:
UserSession
)
=>
{
const
isCurrentSession
=
(
session
:
UserSession
)
=>
{
// A simple heuristic: the most recently accessed session is likely the current one
// A simple heuristic: the most recently accessed session is likely the current one
if
(
userSessions
.
length
===
0
)
return
false
;
if
(
userSessions
.
length
===
0
)
return
false
;
...
@@ -103,9 +91,6 @@ const UserSessionsSection = () => {
...
@@ -103,9 +91,6 @@ const UserSessionsSection = () => {
<
th
scope=
"col"
className=
"px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"
>
<
th
scope=
"col"
className=
"px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"
>
{
t
(
"setting.user-sessions-section.last-active"
)
}
{
t
(
"setting.user-sessions-section.last-active"
)
}
</
th
>
</
th
>
<
th
scope=
"col"
className=
"px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"
>
{
t
(
"setting.user-sessions-section.expires"
)
}
</
th
>
<
th
scope=
"col"
className=
"relative py-3.5 pl-3 pr-4"
>
<
th
scope=
"col"
className=
"relative py-3.5 pl-3 pr-4"
>
<
span
className=
"sr-only"
>
{
t
(
"common.delete"
)
}
</
span
>
<
span
className=
"sr-only"
>
{
t
(
"common.delete"
)
}
</
span
>
</
th
>
</
th
>
...
@@ -137,15 +122,6 @@ const UserSessionsSection = () => {
...
@@ -137,15 +122,6 @@ const UserSessionsSection = () => {
<
span
>
{
userSession
.
lastAccessedTime
?.
toLocaleString
()
}
</
span
>
<
span
>
{
userSession
.
lastAccessedTime
?.
toLocaleString
()
}
</
span
>
</
div
>
</
div
>
</
td
>
</
td
>
<
td
className=
"whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400"
>
<
div
className=
"flex items-center space-x-1"
>
<
ClockIcon
className=
"w-4 h-4"
/>
<
span
>
{
getSessionExpirationDate
(
userSession
)?.
toLocaleString
()
??
t
(
"setting.user-sessions-section.never"
)
}
{
isSessionExpired
(
userSession
)
&&
<
span
className=
"ml-2 text-red-600 text-xs"
>
(Expired)
</
span
>
}
</
span
>
</
div
>
</
td
>
<
td
className=
"relative whitespace-nowrap py-2 pl-3 pr-4 text-right text-sm"
>
<
td
className=
"relative whitespace-nowrap py-2 pl-3 pr-4 text-right text-sm"
>
<
Button
<
Button
variant=
"plain"
variant=
"plain"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment