Update user login time
This commit is contained in:
parent
99ce47e9e5
commit
f9e49e1145
@ -231,6 +231,10 @@ func (db *T) SetSessionUser(uuid string, userID int) (err error) { // {{{
|
||||
}
|
||||
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) {// {{{
|
||||
_, 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/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/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
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)
|
||||
})
|
||||
} // }}}
|
||||
|
@ -118,6 +118,7 @@ func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Reque
|
||||
service.errorHandler(err, "001-A003", w)
|
||||
return
|
||||
}
|
||||
service.Db.UpdateUserTime(userID)
|
||||
}
|
||||
|
||||
authResp, _ := json.Marshal(authResponse)
|
||||
|
Loading…
Reference in New Issue
Block a user