mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-02 00:28:35 +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
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
@ -169,15 +170,18 @@ func (ctrl *V1Controller) HandleUserRequestPasswordReset() errchain.HandlerFunc
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ctrl.svc.User.RequestPasswordReset(r.Context(), v)
|
go func() {
|
||||||
if err != nil {
|
ctx := context.Background()
|
||||||
log.Err(err).Msg("failed to request password reset")
|
|
||||||
return server.Error().
|
|
||||||
Msg("unknow error occurred").
|
|
||||||
Status(http.StatusInternalServerError).
|
|
||||||
Write(r.Context(), w)
|
|
||||||
}
|
|
||||||
|
|
||||||
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…
Add table
Add a link
Reference in a new issue