Trying to refactor

This commit is contained in:
Chris Mann 2023-07-20 11:20:46 +02:00
parent f8ee897d2a
commit 7a7fd592e4
2 changed files with 110 additions and 69 deletions

View file

@ -6,6 +6,7 @@ import (
"regexp"
"sort"
"strings"
"github.com/go-ldap/ldap/v3"
"github.com/gorilla/mux"
)
@ -73,6 +74,13 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
}
sort.Sort(data.Users)
addNewUser(NewUser{CN: "newuser@lesgv.com",
GivenName: "New",
SN: "User",
DisplayName: "New User",
Mail: "newuser@lesgv.com",
})
templateAdminUsers.Execute(w, data)
}
@ -442,7 +450,6 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
}
// log.Printf(fmt.Sprintf("446: %v",path))
// Handle modification operation
if r.Method == "POST" {
r.ParseForm()

34
utils.go Normal file
View file

@ -0,0 +1,34 @@
package main
import (
"fmt"
"log"
// "bytes"
// "crypto/rand"
// "encoding/binary"
// "encoding/hex"
// "fmt"
// "html/template"
// "log"
// "net/http"
// "regexp"
// "strings"
// "github.com/emersion/go-sasl"
// "github.com/emersion/go-smtp"
// "github.com/gorilla/mux"
// "golang.org/x/crypto/argon2"
)
type NewUser struct {
DN string
CN string
GivenName string
DisplayName string
Mail string
SN string
UID string
}
func addNewUser(newUser NewUser) {
log.Printf(fmt.Sprint("Adding New User"))
}