Front-End Stuff

This commit is contained in:
Chris Mann 2023-07-20 19:55:00 +02:00
parent 1cece59c86
commit ed51fe353a
2 changed files with 9 additions and 4 deletions

1
go.mod
View file

@ -14,6 +14,7 @@ require (
github.com/minio/minio-go/v7 v7.0.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
github.com/sethvargo/go-password/password
)
require (

View file

@ -7,7 +7,7 @@ import (
"github.com/go-ldap/ldap/v3"
// "bytes"
// "crypto/rand"
"encoding/binary"
// "encoding/hex"
// "fmt"
// "html/template"
@ -19,6 +19,7 @@ import (
// "github.com/emersion/go-smtp"
// "github.com/gorilla/mux"
// "golang.org/x/crypto/argon2"
"github.com/sethvargo/go-password/password"
)
type NewUser struct {
@ -43,9 +44,12 @@ func openLdap(config ConfigFile) *ldap.Conn {
}
}
func suggestPassword() uint32 {
random := make([]byte, 32)
return binary.BigEndian.Uint32(random[0:12])
func suggestPassword() string {
res, err := password.Generate(10, 2, 2, false, false)
if err != nil {
log.Fatal(err)
}
return res
}
func addNewUser(newUser NewUser, config *ConfigFile, login *LoginStatus) bool {