Adding admin creation, conf and other items

* Config now added, accessible via config.Config
* Admin can now be generated via a randomized URL if there are no admins
in the system
* Added a shared floor to login attempts to block enumeration attacks
This commit is contained in:
🐙PiperYxzzy
2022-05-03 18:46:22 +02:00
parent 3c1970698b
commit 66c35e7e4a
8 changed files with 134 additions and 22 deletions

View File

@@ -8,8 +8,8 @@ import (
"github.com/google/uuid"
)
func GenerateHmac() []byte {
b := make([]byte, 64)
func GenerateHmac(length int) []byte {
b := make([]byte, length)
if _, err := rand.Read(b); err != nil {
panic(err)
}
@@ -30,9 +30,9 @@ type NextMsg struct {
Next string `json:"nextaction"`
}
func SendEmail(title string, body string, recipient string) {
func SendEmail(title string, body string, recipients []string) {
//TODO
fmt.Println("Send", title, body, "to", recipient)
fmt.Println("Send", title, body, "to", recipients)
}
func ParseJwt(tokenStr string, hmac []byte) (jwt.MapClaims, error) {