Password correction on creation

This commit is contained in:
Chris Mann 2023-07-21 22:52:01 +02:00
parent beea53a14e
commit 46bd43d52b

View file

@ -7,6 +7,7 @@ import (
"math/rand" "math/rand"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"golang.org/x/text/encoding/unicode"
) )
type NewUser struct { type NewUser struct {
@ -97,9 +98,9 @@ func addNewUser(newUser NewUser, config *ConfigFile, ldapConn *ldap.Conn) bool {
} }
} }
function encodePassword (inPassword string) (string, error) { func encodePassword(inPassword string) (string, error) {
utf16 := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM) utf16 := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM)
return utf16.NewEncoder().String("\"" + password + "\"") return utf16.NewEncoder().String("\"" + inPassword + "\"")
// if err != nil { // if err != nil {
// log.Printf("Error encoding password: %s", err) // log.Printf("Error encoding password: %s", err)
// return err // return err