From 46bd43d52b8bde07b86fa0ab527e49d2051830e2 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Fri, 21 Jul 2023 22:52:01 +0200 Subject: [PATCH] Password correction on creation --- utils.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.go b/utils.go index 4596f40..73d24e7 100644 --- a/utils.go +++ b/utils.go @@ -7,6 +7,7 @@ import ( "math/rand" "github.com/go-ldap/ldap/v3" + "golang.org/x/text/encoding/unicode" ) type NewUser struct { @@ -97,12 +98,12 @@ 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) - return utf16.NewEncoder().String("\"" + password + "\"") + return utf16.NewEncoder().String("\"" + inPassword + "\"") // if err != nil { // log.Printf("Error encoding password: %s", err) // return err // } -} \ No newline at end of file +}