mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
logging improvements
This commit is contained in:
parent
f40e6efb24
commit
63edd0ed48
@ -38,15 +38,16 @@ func (self *inviteHandler) Handle(params account.InviteParams) middleware.Respon
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
if self.cfg.Registration != nil && self.cfg.Registration.TokenStrategy == "store" {
|
||||
invite, err := str.GetInviteTokenByToken(params.Body.Token, tx)
|
||||
inviteToken, err := str.GetInviteTokenByToken(params.Body.Token, tx)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
logrus.Errorf("cannot get invite token '%v' for '%v': %v", params.Body.Token, params.Body.Email, err)
|
||||
return account.NewInviteBadRequest()
|
||||
}
|
||||
if err := str.DeleteInviteToken(invite.Id, tx); err != nil {
|
||||
if err := str.DeleteInviteToken(inviteToken.Id, tx); err != nil {
|
||||
logrus.Error(err)
|
||||
return account.NewInviteInternalServerError()
|
||||
}
|
||||
logrus.Infof("using invite token '%v' to process invite request for '%v'", inviteToken.Token, params.Body.Email)
|
||||
}
|
||||
|
||||
token, err = createToken()
|
||||
|
@ -23,7 +23,7 @@ func (str *Store) CreateInviteTokens(inviteTokens []*InviteToken, tx *sqlx.Tx) e
|
||||
}
|
||||
stmt, err := tx.Prepare(fmt.Sprintf(sql, strings.Join(queries, ",")))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error preparing invite_tokenss insert statement")
|
||||
return errors.Wrap(err, "error preparing invite_tokens insert statement")
|
||||
}
|
||||
if _, err := stmt.Exec(invs...); err != nil {
|
||||
return errors.Wrap(err, "error executing invites_tokens insert statement")
|
||||
|
Loading…
Reference in New Issue
Block a user