Logging update

This commit is contained in:
Jesse Malotaux 2025-04-11 17:49:28 +02:00
parent 541f016eaf
commit 2098aface9
13 changed files with 119 additions and 91 deletions

View file

@ -1,25 +1,22 @@
package helper
import (
"log"
"errors"
"os"
"time"
)
func TempPinFile(Uuid string, pin string) bool {
log.Println("temp pin file", Uuid, pin)
func TempPinFile(Uuid string, pin string) (bool, error) {
err := os.WriteFile("devices/"+Uuid+".tmp", []byte(pin), 0644)
if err != nil {
log.Println(err)
return false
return false, errors.New("TempPinFile Error: " + err.Error())
}
time.AfterFunc(1*time.Minute, func() {
log.Println("deleting", Uuid, pin)
os.Remove("devices/" + Uuid + ".tmp")
})
return true
return true, nil
}
func CheckPinFile(Uuid string) bool {