mirror of
https://github.com/pushbits/server.git
synced 2025-07-30 06:39:13 +02:00
Use logrus for logging
This commit is contained in:
parent
c96baf40a5
commit
f839f248b9
19 changed files with 192 additions and 87 deletions
|
@ -4,9 +4,10 @@ import (
|
|||
"crypto/sha1" //#nosec G505 -- False positive, see the use below.
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/pushbits/server/internal/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -27,7 +28,7 @@ func IsPasswordPwned(password string) (bool, error) {
|
|||
lookup := hashStr[0:5]
|
||||
match := hashStr[5:]
|
||||
|
||||
log.Printf("Checking HIBP for hashes starting with '%s'.", lookup)
|
||||
log.L.Printf("Checking HIBP for hashes starting with '%s'.", lookup)
|
||||
|
||||
resp, err := http.Get(pwnedHashesURL + lookup)
|
||||
if err != nil {
|
||||
|
@ -35,13 +36,13 @@ func IsPasswordPwned(password string) (bool, error) {
|
|||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Fatalf("Request failed with HTTP %s.", resp.Status)
|
||||
log.L.Fatalf("Request failed with HTTP %s.", resp.Status)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
bodyText, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.L.Fatal(err)
|
||||
}
|
||||
|
||||
bodyStr := string(bodyText)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue