mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-25 18:15:40 +00:00
auto return 204 and run request in background
This commit is contained in:
parent
b96fb4bb9e
commit
f4c63613d5
1 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
|
@ -169,15 +170,18 @@ func (ctrl *V1Controller) HandleUserRequestPasswordReset() errchain.HandlerFunc
|
|||
return err
|
||||
}
|
||||
|
||||
err = ctrl.svc.User.RequestPasswordReset(r.Context(), v)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("failed to request password reset")
|
||||
return server.Error().
|
||||
Msg("unknow error occurred").
|
||||
Status(http.StatusInternalServerError).
|
||||
Write(r.Context(), w)
|
||||
}
|
||||
go func() {
|
||||
ctx := context.Background()
|
||||
|
||||
return nil
|
||||
err = ctrl.svc.User.RequestPasswordReset(ctx, v)
|
||||
if err != nil {
|
||||
log.Warn().
|
||||
Err(err).
|
||||
Str("email", v.Email).
|
||||
Msg("failed to request password reset")
|
||||
}
|
||||
}()
|
||||
|
||||
return server.JSON(w, http.StatusNoContent, nil)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue