Skip to content

Commit

Permalink
Fix internal passport scan
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaptoss committed Jul 29, 2024
1 parent 878583d commit 0f051d3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions internal/service/handlers/verify_internal_passport.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func VerifyInternalPassport(w http.ResponseWriter, r *http.Request) {
sharedHash = &h
}

if sharedHash == nil {
empty := ""
sharedHash = &empty
}

bySharedHash, err := BalancesQ(r).FilterBySharedHash(*sharedHash).Get()
if err != nil {
log.WithError(err).Error("Failed to get balance by shared hash")
Expand All @@ -110,7 +115,7 @@ func VerifyInternalPassport(w http.ResponseWriter, r *http.Request) {
ape.RenderErr(w, problems.Conflict())
return
}
if proof == nil {
if proof == nil && *sharedHash == "" {
log.Warnf("Balance %s tried to re-join program", balance.Nullifier)
ape.RenderErr(w, problems.Conflict())
return
Expand Down Expand Up @@ -167,11 +172,17 @@ func VerifyInternalPassport(w http.ResponseWriter, r *http.Request) {

balance.InternalAID = &internalAID

if err = autoClaimEventsForBalance(r, balance); err != nil {
return fmt.Errorf("failed to autoclaim events for user")
}
if balance.IsVerified() {
return nil
}

if err := addEventForReferrer(r, balance); err != nil {
return fmt.Errorf("add event for referrer: %w", err)
}

return autoClaimEventsForBalance(r, balance)
return nil
})

if err != nil {
Expand Down

0 comments on commit 0f051d3

Please sign in to comment.