diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2022-03-02 16:33:47 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-02 16:33:47 +1100 |
| commit | d867fa1a63c53245525c21f7ce371dffbcbebf5e (patch) | |
| tree | 41d047e0271acf25962b296cfdef9aedd53750d6 /internal/storage/sql_provider.go | |
| parent | 6ef6d0499ab0db5155a48fc70b9419f9c3788ac6 (diff) | |
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.
Diffstat (limited to 'internal/storage/sql_provider.go')
| -rw-r--r-- | internal/storage/sql_provider.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/storage/sql_provider.go b/internal/storage/sql_provider.go index dfbf43de4..42673d2b4 100644 --- a/internal/storage/sql_provider.go +++ b/internal/storage/sql_provider.go @@ -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 } |
