missing deferred rollback (#50)

This commit is contained in:
Michael Quigley 2022-09-20 16:28:19 -04:00
parent 27d1f390a5
commit 5fae000dad
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -23,11 +23,14 @@ func (self *verifyHandler) Handle(params identity.VerifyParams) middleware.Respo
logrus.Errorf("error starting transaction: %v", err)
return identity.NewVerifyInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
}
defer func() { _ = tx.Rollback() }()
ar, err := str.FindAccountRequestWithToken(params.Body.Token, tx)
if err != nil {
logrus.Errorf("error finding account with token '%v': %v", params.Body.Token, err)
return identity.NewVerifyNotFound()
}
return identity.NewVerifyOK().WithPayload(&rest_model_zrok.VerifyResponse{Email: ar.Email})
} else {
logrus.Error("empty verification request")