Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix zk wallet login #171

Merged
merged 3 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/v1/authenticate/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func ApplyRoutes(r *gin.RouterGroup) {
g := r.Group("/authenticate")
{
g.POST("", authenticate)
g.POST("/NonSign", authenticateNonSignature)
g.Use(paseto.PASETO(false))
g.GET("", authenticateToken)
g.GET("/nonSign", authenticateNonSignature)
}
}

Expand Down Expand Up @@ -179,6 +179,7 @@ func authenticateNonSignature(c *gin.Context) {
httpo.NewErrorResponse(http.StatusBadRequest, fmt.Sprintf("payload is invalid: %s", err)).SendD(c)
return
}

//Get flowid type
var flowIdData models.FlowId
err = db.Model(&models.FlowId{}).Where("flow_id = ?", req.FlowId).First(&flowIdData).Error
Expand All @@ -187,6 +188,7 @@ func authenticateNonSignature(c *gin.Context) {
httpo.NewErrorResponse(http.StatusNotFound, "flow id not found").SendD(c)
return
}

if flowIdData.FlowIdType != models.AUTH {
httpo.NewErrorResponse(http.StatusBadRequest, "flow id not created for auth").SendD(c)
return
Expand Down