Skip to content

Commit 3df8a86

Browse files
committed
fix otp issue
1 parent 0513ab0 commit 3df8a86

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internal/services/otp/service.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ func (s *Service) Email(email string) int {
3838

3939
func (s *Service) Check(identifier string, password string) bool {
4040
if p, found := s.passwords[identifier]; found {
41-
defer delete(s.passwords, identifier)
4241
if p.ExpireAt.Before(time.Now().Add(min3)) {
43-
return p.Value == password
42+
if p.Value == password {
43+
delete(s.passwords, identifier)
44+
return true
45+
}
46+
} else {
47+
delete(s.passwords, identifier)
4448
}
4549
}
4650
return false

0 commit comments

Comments
 (0)