failing token invites fail with 401; display a hint about --token in the cli error message (#172)

This commit is contained in:
Michael Quigley
2023-01-19 15:40:41 -05:00
parent 1c77fdc065
commit 73f068c54a
6 changed files with 92 additions and 1 deletions

View File

@ -41,7 +41,7 @@ func (self *inviteHandler) Handle(params account.InviteParams) middleware.Respon
inviteToken, err := str.GetInviteTokenByToken(params.Body.Token, tx)
if err != nil {
logrus.Errorf("cannot get invite token '%v' for '%v': %v", params.Body.Token, params.Body.Email, err)
return account.NewInviteBadRequest()
return account.NewInviteUnauthorized()
}
if err := str.DeleteInviteToken(inviteToken.Id, tx); err != nil {
logrus.Error(err)