change error message a bit

This commit is contained in:
tsmethurst 2021-10-18 16:07:18 +02:00
commit e94c686dc5
2 changed files with 2 additions and 2 deletions

View file

@ -114,7 +114,7 @@ func (p *processor) ConfirmEmail(ctx context.Context, token string) (*gtsmodel.U
} }
if user.ConfirmationSentAt.Before(time.Now().Add(-oneWeek)) { if user.ConfirmationSentAt.Before(time.Now().Add(-oneWeek)) {
return nil, gtserror.NewErrorForbidden(errors.New("confirmation token more than a week old, please request a new one")) return nil, gtserror.NewErrorForbidden(errors.New("ConfirmEmail: confirmation token expired"))
} }
// mark the user's email address as confirmed + remove the unconfirmed address and the token // mark the user's email address as confirmed + remove the unconfirmed address and the token

View file

@ -106,7 +106,7 @@ func (suite *EmailConfirmTestSuite) TestConfirmEmailOldToken() {
// confirm with the token set above // confirm with the token set above
updatedUser, errWithCode := suite.user.ConfirmEmail(ctx, "1d1aa44b-afa4-49c8-ac4b-eceb61715cc6") updatedUser, errWithCode := suite.user.ConfirmEmail(ctx, "1d1aa44b-afa4-49c8-ac4b-eceb61715cc6")
suite.Nil(updatedUser) suite.Nil(updatedUser)
suite.EqualError(errWithCode, "confirmation token more than a week old, please request a new one") suite.EqualError(errWithCode, "ConfirmEmail: confirmation token expired")
} }
func TestEmailConfirmTestSuite(t *testing.T) { func TestEmailConfirmTestSuite(t *testing.T) {