Skip to content

Commit

Permalink
authenticate: update user table after nonSign
Browse files Browse the repository at this point in the history
  • Loading branch information
inciner8r committed Apr 16, 2024
1 parent 3304b57 commit 8a7d1e7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/v1/authenticate/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ func authenticateNonSignature(c *gin.Context) {
httpo.NewErrorResponse(http.StatusBadRequest, "WalletAddress incorrect").SendD(c)
return
}

// update wallet address for that user_id
err = db.Model(&models.User{}).Where("user_id = ?", flowIdData.UserId).Update("wallet_address", flowIdData.WalletAddress).Error
if err != nil {
httpo.NewErrorResponse(http.StatusInternalServerError, "Unexpected error occured").SendD(c)
logwrapper.Errorf("failed to update wallet address, error %v", err.Error())
return
}

customClaims := claims.NewWithWallet(flowIdData.UserId, &flowIdData.WalletAddress)
pvKey, err := hex.DecodeString(envconfig.EnvVars.PASETO_PRIVATE_KEY[2:])
if err != nil {
Expand Down

0 comments on commit 8a7d1e7

Please sign in to comment.