mirror of https://github.com/usememos/memos.git
chore: update user session section
This commit is contained in:
parent
b8a37c7229
commit
59eae4465a
|
|
@ -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 {
|
||||
// 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
|
||||
sessionID, err := GenerateSessionID()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ const MyAccountSection = () => {
|
|||
</Popover>
|
||||
</div>
|
||||
|
||||
<AccessTokenSection />
|
||||
<UserSessionsSection />
|
||||
<AccessTokenSection />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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"]) => {
|
||||
if (!clientInfo) return "Unknown Device";
|
||||
|
||||
|
|
@ -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">
|
||||
{t("setting.user-sessions-section.device")}
|
||||
</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">
|
||||
{t("setting.user-sessions-section.last-active")}
|
||||
</th>
|
||||
|
|
@ -131,9 +119,6 @@ const UserSessionsSection = () => {
|
|||
</div>
|
||||
</div>
|
||||
</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">
|
||||
<div className="flex items-center space-x-1">
|
||||
<ClockIcon className="w-4 h-4" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue