Password correction on creation
This commit is contained in:
parent
beea53a14e
commit
46bd43d52b
1 changed files with 4 additions and 3 deletions
7
utils.go
7
utils.go
|
@ -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,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)
|
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
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue