2018-01-26 12:38:19 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
2018-06-16 18:58:13 +02:00
|
|
|
|
|
|
|
"github.com/dchest/captcha"
|
|
|
|
"github.com/npenkov/ldap-passwd-webui/app"
|
2018-01-26 12:38:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
reHandler := new(app.RegexpHandler)
|
|
|
|
|
|
|
|
reHandler.HandleFunc(".*.[js|css|png|eof|svg|ttf|woff]", "GET", app.ServeAssets)
|
|
|
|
reHandler.HandleFunc("/", "GET", app.ServeIndex)
|
|
|
|
reHandler.HandleFunc("/", "POST", app.ChangePassword)
|
2018-06-16 18:58:13 +02:00
|
|
|
http.Handle("/captcha/", captcha.Server(captcha.StdWidth, captcha.StdHeight))
|
|
|
|
http.Handle("/", reHandler)
|
2018-01-26 12:38:19 +01:00
|
|
|
fmt.Println("Starting server on port 8080")
|
2018-06-16 18:58:13 +02:00
|
|
|
http.ListenAndServe(":8080", nil)
|
2018-01-26 12:38:19 +01:00
|
|
|
}
|