fix(storage): return reason for identity verification not being found (#2937)

This includes the reason a token was not found during the identity verification process.
This commit is contained in:
James Elliott 2022-03-02 16:33:47 +11:00 committed by GitHub
parent 6ef6d0499a
commit d867fa1a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,8 +255,10 @@ func (p *SQLProvider) FindIdentityVerification(ctx context.Context, jti string)
}
switch {
case verification.Consumed != nil, verification.ExpiresAt.Before(time.Now()):
return false, nil
case verification.Consumed != nil:
return false, fmt.Errorf("the token has already been consumed")
case verification.ExpiresAt.Before(time.Now()):
return false, fmt.Errorf("the token expired %s ago", time.Since(verification.ExpiresAt))
default:
return true, nil
}