go fmt
This commit is contained in:
parent
f819320f5a
commit
b8d9118b56
2
ldap.go
2
ldap.go
@ -48,7 +48,6 @@ func (l LDAP) Connect() (*LDAPConn, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type LDAPConn struct {
|
type LDAPConn struct {
|
||||||
LDAP
|
LDAP
|
||||||
connection *ldap.Conn
|
connection *ldap.Conn
|
||||||
@ -125,6 +124,5 @@ func (l LDAPConn) ChangePassword(dn string, rawpassword string) error {
|
|||||||
modify := ldap.NewModifyRequest(dn)
|
modify := ldap.NewModifyRequest(dn)
|
||||||
modify.Replace("userPassword", []string{"{CRYPT}" + hashedpasswd})
|
modify.Replace("userPassword", []string{"{CRYPT}" + hashedpasswd})
|
||||||
|
|
||||||
|
|
||||||
return l.connection.Modify(modify)
|
return l.connection.Modify(modify)
|
||||||
}
|
}
|
||||||
|
3
lost.go
3
lost.go
@ -5,8 +5,8 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
@ -51,7 +51,6 @@ func (l LDAPConn) genToken(dn string, previous bool) string {
|
|||||||
return base64.StdEncoding.EncodeToString(hash.Sum(nil)[:])
|
return base64.StdEncoding.EncodeToString(hash.Sum(nil)[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func lostPassword(w http.ResponseWriter, r *http.Request) {
|
func lostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != "POST" {
|
||||||
displayTmpl(w, "lost.html", map[string]interface{}{})
|
displayTmpl(w, "lost.html", map[string]interface{}{})
|
||||||
|
1
main.go
1
main.go
@ -23,7 +23,6 @@ var myLDAP = LDAP{
|
|||||||
BaseDN: "dc=example,dc=com",
|
BaseDN: "dc=example,dc=com",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type ResponseWriterPrefix struct {
|
type ResponseWriterPrefix struct {
|
||||||
real http.ResponseWriter
|
real http.ResponseWriter
|
||||||
prefix string
|
prefix string
|
||||||
|
1
reset.go
1
reset.go
@ -6,7 +6,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func resetPassword(w http.ResponseWriter, r *http.Request) {
|
func resetPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
if len(r.URL.Query().Get("l")) == 0 || len(r.URL.Query().Get("t")) == 0 {
|
if len(r.URL.Query().Get("l")) == 0 || len(r.URL.Query().Get("t")) == 0 {
|
||||||
http.Redirect(w, r, "lost", http.StatusFound)
|
http.Redirect(w, r, "lost", http.StatusFound)
|
||||||
|
Loading…
Reference in New Issue
Block a user