Commit 59eae446 authored by Steven's avatar Steven

chore: update user session section

parent b8a37c72
...@@ -178,15 +178,6 @@ func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSe ...@@ -178,15 +178,6 @@ func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSe
} }
func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTime time.Time) error { func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTime time.Time) error {
// Generate JWT access token for API use
accessToken, err := GenerateAccessToken(user.Email, user.ID, expireTime, []byte(s.Secret))
if err != nil {
return status.Errorf(codes.Internal, "failed to generate access token, error: %v", err)
}
if err := s.UpsertAccessTokenToStore(ctx, user, accessToken, "user login"); err != nil {
return status.Errorf(codes.Internal, "failed to upsert access token to store, error: %v", err)
}
// Generate unique session ID for web use // Generate unique session ID for web use
sessionID, err := GenerateSessionID() sessionID, err := GenerateSessionID()
if err != nil { if err != nil {
......
...@@ -48,8 +48,8 @@ const MyAccountSection = () => { ...@@ -48,8 +48,8 @@ const MyAccountSection = () => {
</Popover> </Popover>
</div> </div>
<AccessTokenSection />
<UserSessionsSection /> <UserSessionsSection />
<AccessTokenSection />
</div> </div>
); );
}; };
......
...@@ -50,15 +50,6 @@ const UserSessionsSection = () => { ...@@ -50,15 +50,6 @@ const UserSessionsSection = () => {
} }
}; };
const formatLocation = (clientInfo: UserSession["clientInfo"]) => {
if (!clientInfo) return "Unknown";
const parts = [];
if (clientInfo.ipAddress) parts.push(clientInfo.ipAddress);
return parts.length > 0 ? parts.join(" • ") : "Unknown";
};
const formatDeviceInfo = (clientInfo: UserSession["clientInfo"]) => { const formatDeviceInfo = (clientInfo: UserSession["clientInfo"]) => {
if (!clientInfo) return "Unknown Device"; if (!clientInfo) return "Unknown Device";
...@@ -97,9 +88,6 @@ const UserSessionsSection = () => { ...@@ -97,9 +88,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.device")} {t("setting.user-sessions-section.device")}
</th> </th>
<th scope="col" className="py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
{t("setting.user-sessions-section.location")}
</th>
<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>
...@@ -131,9 +119,6 @@ const UserSessionsSection = () => { ...@@ -131,9 +119,6 @@ const UserSessionsSection = () => {
</div> </div>
</div> </div>
</td> </td>
<td className="whitespace-nowrap py-2 pl-4 pr-3 text-sm text-gray-900 dark:text-gray-400">
{formatLocation(userSession.clientInfo)}
</td>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400"> <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"> <div className="flex items-center space-x-1">
<ClockIcon className="w-4 h-4" /> <ClockIcon className="w-4 h-4" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment