Skip to content

Commit

Permalink
fix(storage): return reason for identity verification not being found (
Browse files Browse the repository at this point in the history
…authelia#2937)

This includes the reason a token was not found during the identity verification process.
  • Loading branch information
james-d-elliott authored Mar 2, 2022
1 parent 6ef6d04 commit d867fa1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/storage/sql_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d867fa1

Please sign in to comment.