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
|
||||
|
||||
type LostPasswordData struct {
|
||||
ErrorMessage string
|
||||
Success bool
|
||||
Username string
|
||||
Mail string
|
||||
OtherMailbox string
|
||||
|
@ -46,19 +48,21 @@ type LostPasswordData struct {
|
|||
|
||||
func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||
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{
|
||||
Username: "",
|
||||
Mail: "",
|
||||
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" {
|
||||
r.ParseForm()
|
||||
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)
|
||||
if err != nil {
|
||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))
|
||||
data.ErrorMessage = err.Error()
|
||||
} else {
|
||||
data.Success = true
|
||||
}
|
||||
}
|
||||
templateLostPasswordPage.Execute(w, data)
|
||||
|
|
Loading…
Reference in a new issue