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/minio/minio-go/v7 v7.0.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
github.com/sethvargo/go-password/password
) )
require ( require (

View file

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