Front-End Stuff
This commit is contained in:
parent
ed51fe353a
commit
1dbe41811e
2 changed files with 6 additions and 6 deletions
1
go.mod
1
go.mod
|
@ -14,7 +14,6 @@ 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 (
|
||||||
|
|
11
utils.go
11
utils.go
|
@ -19,7 +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"
|
"math/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NewUser struct {
|
type NewUser struct {
|
||||||
|
@ -45,11 +45,12 @@ func openLdap(config ConfigFile) *ldap.Conn {
|
||||||
}
|
}
|
||||||
|
|
||||||
func suggestPassword() string {
|
func suggestPassword() string {
|
||||||
res, err := password.Generate(10, 2, 2, false, false)
|
password := ""
|
||||||
if err != nil {
|
chars := "abcdfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*+_-="
|
||||||
log.Fatal(err)
|
for i := 0; i < 12; i++ {
|
||||||
|
password += string([]rune(chars)[rand.Intn(len(chars))])
|
||||||
}
|
}
|
||||||
return res
|
return password
|
||||||
}
|
}
|
||||||
|
|
||||||
func addNewUser(newUser NewUser, config *ConfigFile, login *LoginStatus) bool {
|
func addNewUser(newUser NewUser, config *ConfigFile, login *LoginStatus) bool {
|
||||||
|
|
Loading…
Reference in a new issue