Compare commits
2 Commits
99ce47e9e5
...
15abdd4081
Author | SHA1 | Date | |
---|---|---|---|
15abdd4081 | |||
f9e49e1145 |
@ -231,6 +231,10 @@ func (db *T) SetSessionUser(uuid string, userID int) (err error) { // {{{
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
} // }}}
|
} // }}}
|
||||||
|
func (db *T) UpdateUserTime(userID int) (err error) {// {{{
|
||||||
|
_, err = db.Conn.Exec(`UPDATE _webservice.user SET last_login=NOW() WHERE id=$1`, userID)
|
||||||
|
return
|
||||||
|
}// }}}
|
||||||
|
|
||||||
func (db *T) CreateUser(username, password, name string) (err error) {// {{{
|
func (db *T) CreateUser(username, password, name string) (err error) {// {{{
|
||||||
_, err = db.Conn.Exec(`
|
_, err = db.Conn.Exec(`
|
||||||
|
1
go.sum
1
go.sum
@ -1,5 +1,6 @@
|
|||||||
git.gibonuddevalla.se/go/dbschema v1.2.0 h1:VhHFfkn/4UnlGy2Ax35Po8vb8E/x6DggtvNUKlGGQyY=
|
git.gibonuddevalla.se/go/dbschema v1.2.0 h1:VhHFfkn/4UnlGy2Ax35Po8vb8E/x6DggtvNUKlGGQyY=
|
||||||
git.gibonuddevalla.se/go/dbschema v1.2.0/go.mod h1:BNw3q/574nXbGoeWyK+tLhRfggVkw2j2aXZzrBKC3ig=
|
git.gibonuddevalla.se/go/dbschema v1.2.0/go.mod h1:BNw3q/574nXbGoeWyK+tLhRfggVkw2j2aXZzrBKC3ig=
|
||||||
|
git.gibonuddevalla.se/go/dbschema v1.3.0/go.mod h1:BNw3q/574nXbGoeWyK+tLhRfggVkw2j2aXZzrBKC3ig=
|
||||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||||
|
1
pkg.go
1
pkg.go
@ -207,6 +207,7 @@ func (service *Service) Register(path string, requireSession, requireAuthenticat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service.logger.Info("webserver", "op", "request", "path", r.URL.String())
|
||||||
handler(w, r, sess)
|
handler(w, r, sess)
|
||||||
})
|
})
|
||||||
} // }}}
|
} // }}}
|
||||||
|
@ -118,6 +118,7 @@ func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Reque
|
|||||||
service.errorHandler(err, "001-A003", w)
|
service.errorHandler(err, "001-A003", w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
service.Db.UpdateUserTime(userID)
|
||||||
}
|
}
|
||||||
|
|
||||||
authResp, _ := json.Marshal(authResponse)
|
authResp, _ := json.Marshal(authResponse)
|
||||||
|
@ -14,4 +14,6 @@ type T struct {
|
|||||||
UserID int `db:"user_id"`
|
UserID int `db:"user_id"`
|
||||||
Username string
|
Username string
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
ApplicationData any
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user