Implementing Activate User

This commit is contained in:
Chris Mann 2023-07-21 09:41:30 +02:00
parent 639695d26d
commit 4dda9c91cb
2 changed files with 11 additions and 5 deletions

View file

@ -93,7 +93,7 @@ function changeDisplayname () {
displayname = document.getElementById("displayname");
username = document.getElementById("username");
givenname = document.getElementById("givenname");
sn = document.getElementById("sn");
surname = document.getElementById("surname");
if (!username.value) {
username.value = displayname.value;
changeUsername();
@ -101,8 +101,8 @@ function changeDisplayname () {
if (!givenname.value) {
givenname.value = displayname.value.split(" ")[0];
}
if (!sn.value) {
sn.value = displayname.value.split(" ")[1];
if (!surname.value) {
surname.value = displayname.value.split(" ")[1];
}
}
function changeUsername () {

View file

@ -1,6 +1,7 @@
package main
import (
"crypto/tls"
"fmt"
"log"
@ -43,7 +44,12 @@ func suggestPassword() string {
func addNewUser(newUser NewUser, config *ConfigFile) bool {
log.Printf(fmt.Sprint("Adding New User"))
l, _ := ldap.DialURL(config.LdapServerAddr)
err := l.StartTLS(&tls.Config{InsecureSkipVerify: true})
if err != nil {
log.Printf(fmt.Sprintf("86: %v", err))
}
l.Bind(config.NewUserDN, config.NewUserPassword)
// l.Bind(config.)
dn := newUser.DN
req := ldap.NewAddRequest(dn, nil)
@ -76,12 +82,12 @@ func addNewUser(newUser NewUser, config *ConfigFile) bool {
// conn :=
err := l.Add(req)
err = l.Add(req)
log.Printf(fmt.Sprintf("71: %v", err))
log.Printf(fmt.Sprintf("72: %v", req))
log.Printf(fmt.Sprintf("73: %v", newUser))
if err != nil {
log.Printf(fmt.Sprintf("75: %v", err))
log.Printf(fmt.Sprintf("86: %v", err))
return false
} else {
return true