mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Replace basic auth with cookie authentication (#440)
* Add logout functionality and button * Make session age configurable
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user