G Pas
This commit is contained in:
parent
12d96166b5
commit
ac5aa4eb7e
1 changed files with 15 additions and 8 deletions
23
invite.go
23
invite.go
|
@ -39,6 +39,8 @@ func checkInviterLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
|
||||||
// New account creation directly from interface
|
// New account creation directly from interface
|
||||||
|
|
||||||
type LostPasswordData struct {
|
type LostPasswordData struct {
|
||||||
|
ErrorMessage string
|
||||||
|
Success bool
|
||||||
Username string
|
Username string
|
||||||
Mail string
|
Mail string
|
||||||
OtherMailbox string
|
OtherMailbox string
|
||||||
|
@ -46,19 +48,21 @@ type LostPasswordData struct {
|
||||||
|
|
||||||
func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
templateLostPasswordPage := getTemplate("lost_password.html")
|
templateLostPasswordPage := getTemplate("lost_password.html")
|
||||||
l, err := ldapOpen(w)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
|
||||||
}
|
|
||||||
err = l.Bind(config.NewUserDN, config.NewUserPassword)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
|
||||||
}
|
|
||||||
data := LostPasswordData{
|
data := LostPasswordData{
|
||||||
Username: "",
|
Username: "",
|
||||||
Mail: "",
|
Mail: "",
|
||||||
OtherMailbox: "",
|
OtherMailbox: "",
|
||||||
}
|
}
|
||||||
|
l, err := ldapOpen(w)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
||||||
|
data.ErrorMessage = err.Error()
|
||||||
|
}
|
||||||
|
err = l.Bind(config.NewUserDN, config.NewUserPassword)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
||||||
|
data.ErrorMessage = err.Error()
|
||||||
|
}
|
||||||
if r.Method == "POST" {
|
if r.Method == "POST" {
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
data.Username = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
data.Username = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
||||||
|
@ -73,6 +77,9 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
err = l.Bind(config.NewUserDN, config.NewUserPassword)
|
err = l.Bind(config.NewUserDN, config.NewUserPassword)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
||||||
|
data.ErrorMessage = err.Error()
|
||||||
|
} else {
|
||||||
|
data.Success = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templateLostPasswordPage.Execute(w, data)
|
templateLostPasswordPage.Execute(w, data)
|
||||||
|
|
Loading…
Reference in a new issue