Add account settings (#686)

Add account settings with a global peer expiration flag and duration
This commit is contained in:
Misha Bragin
2023-02-13 09:07:15 -05:00
committed by GitHub
parent 3fc89749c1
commit d5dfed498b
6 changed files with 75 additions and 37 deletions

View File

@@ -136,7 +136,7 @@ func (s *GRPCServer) Sync(req *proto.EncryptedMessage, srv proto.ManagementServi
if err != nil {
return status.Error(codes.Internal, "internal server error")
}
expired, left := peer.LoginExpired(account.PeerLoginExpiration)
expired, left := peer.LoginExpired(account.Settings)
if peer.UserID != "" && expired {
return status.Errorf(codes.PermissionDenied, "peer login has expired %v ago. Please log in once more", left)
}
@@ -376,7 +376,7 @@ func (s *GRPCServer) Login(ctx context.Context, req *proto.EncryptedMessage) (*p
if err != nil {
return nil, status.Error(codes.Internal, "internal server error")
}
expired, left := peer.LoginExpired(account.PeerLoginExpiration)
expired, left := peer.LoginExpired(account.Settings)
if peer.UserID != "" && expired {
// it might be that peer expired but user has logged in already, check token then
if loginReq.GetJwtToken() == "" {