aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.go b/main.go
index 7d172b7..2c79316 100644
--- a/main.go
+++ b/main.go
@@ -7,7 +7,7 @@ import (
)
type App struct {
- SessionStore
+ Store
}
func logMux(handler http.Handler) http.Handler {
@@ -35,6 +35,22 @@ func (app *App) rootHandler(w http.ResponseWriter, r *http.Request) {
}
}
+func (app *App) loginHandler(w http.ResponseWriter, r *http.Request) {
+ if r.Method == http.MethodPost {
+ if err := r.ParseForm(); err != nil {
+ panic(err)
+ } else {
+ username := r.Form.Get("username")
+ password := r.Form.Get("password")
+ row := app.Query("SELECT id FROM users WHERE user_name = ?", username)
+ var id int64
+ if err := row.rowScan(&id); err != nil {
+ panic(err)
+ }
+ }
+ }
+}
+
func main() {
//log.SetFlags(log.LstdFlags)
store := NewPgStore()