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.
pull/2938/head
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
1 changed files with 4 additions and 2 deletions

View File

@ -255,8 +255,10 @@ func (p *SQLProvider) FindIdentityVerification(ctx context.Context, jti string)
} }
switch { switch {
case verification.Consumed != nil, verification.ExpiresAt.Before(time.Now()): case verification.Consumed != nil:
return false, 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: default:
return true, nil return true, nil
} }