Replace basic auth with cookie authentication (#440)

* Add logout functionality and button
* Make session age configurable
This commit is contained in:
WithoutPants
2020-04-08 12:51:12 +10:00
committed by GitHub
parent b3e8d1e8dd
commit 15e7756d33
73 changed files with 12297 additions and 49 deletions

View File

@@ -2,6 +2,7 @@ package utils
import (
"crypto/md5"
"crypto/rand"
"fmt"
"io"
"os"
@@ -31,3 +32,9 @@ func MD5FromFilePath(filePath string) (string, error) {
checksum := h.Sum(nil)
return fmt.Sprintf("%x", checksum), nil
}
func GenerateRandomKey(l int) string {
b := make([]byte, l)
rand.Read(b)
return fmt.Sprintf("%x", b)
}