Only keep clean IP address
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.gearno.de/kit/log"
|
"go.gearno.de/kit/log"
|
||||||
@@ -600,13 +601,18 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
|
|||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
|
||||||
|
if signerIP == "" {
|
||||||
|
signerIP = httpReq.RemoteAddr
|
||||||
|
}
|
||||||
|
|
||||||
signature, err := r.esign.AcceptSignature(
|
signature, err := r.esign.AcceptSignature(
|
||||||
ctx,
|
ctx,
|
||||||
&esign.AcceptSignatureRequest{
|
&esign.AcceptSignatureRequest{
|
||||||
SignatureID: input.SignatureID,
|
SignatureID: input.SignatureID,
|
||||||
SignerFullName: input.FullName,
|
SignerFullName: input.FullName,
|
||||||
SignerEmail: identity.EmailAddress,
|
SignerEmail: identity.EmailAddress,
|
||||||
SignerIPAddr: httpReq.RemoteAddr,
|
SignerIPAddr: signerIP,
|
||||||
SignerUA: httpReq.UserAgent(),
|
SignerUA: httpReq.UserAgent(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -627,6 +633,11 @@ func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.R
|
|||||||
httpReq = gqlutils.HTTPRequestFromContext(ctx)
|
httpReq = gqlutils.HTTPRequestFromContext(ctx)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
actorIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
|
||||||
|
if actorIP == "" {
|
||||||
|
actorIP = httpReq.RemoteAddr
|
||||||
|
}
|
||||||
|
|
||||||
if err := r.esign.RecordEvent(
|
if err := r.esign.RecordEvent(
|
||||||
ctx,
|
ctx,
|
||||||
&esign.RecordEventRequest{
|
&esign.RecordEventRequest{
|
||||||
@@ -634,7 +645,7 @@ func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.R
|
|||||||
EventType: input.EventType,
|
EventType: input.EventType,
|
||||||
EventSource: coredata.ElectronicSignatureEventSourceClient,
|
EventSource: coredata.ElectronicSignatureEventSourceClient,
|
||||||
ActorEmail: identity.EmailAddress,
|
ActorEmail: identity.EmailAddress,
|
||||||
ActorIPAddr: httpReq.RemoteAddr,
|
ActorIPAddr: actorIP,
|
||||||
ActorUA: httpReq.UserAgent(),
|
ActorUA: httpReq.UserAgent(),
|
||||||
},
|
},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user