feat: add new event supportting for the action login.

This commit is contained in:
hunt978 2022-03-29 01:26:43 +08:00
parent f8dfbf7eee
commit a3ad08a67a
2 changed files with 5 additions and 1 deletions

View File

@ -174,7 +174,7 @@ var renewHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data
return printToken(w, r, d, d.user) return printToken(w, r, d, d.user)
}) })
func printToken(w http.ResponseWriter, _ *http.Request, d *data, user *users.User) (int, error) { func printToken(w http.ResponseWriter, r *http.Request, d *data, user *users.User) (int, error) {
claims := &authToken{ claims := &authToken{
User: userInfo{ User: userInfo{
ID: user.ID, ID: user.ID,
@ -204,5 +204,8 @@ func printToken(w http.ResponseWriter, _ *http.Request, d *data, user *users.Use
if _, err := w.Write([]byte(signed)); err != nil { if _, err := w.Write([]byte(signed)); err != nil {
return http.StatusInternalServerError, err return http.StatusInternalServerError, err
} }
err = d.RunHook(func() error { return nil }, "login", r.URL.Path, "", user)
return 0, nil return 0, nil
} }

View File

@ -35,6 +35,7 @@ var defaultEvents = []string{
"rename", "rename",
"upload", "upload",
"delete", "delete",
"login",
} }
// Save saves the settings for the current instance. // Save saves the settings for the current instance.