dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit f061244c73cf12d3bd37449df2090e3b12286ad7
parent 2dfdb0ec235dc0ab78ed8cc90a7965b3813f4108
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 14 Dec 2023 18:55:47 -0500

add reset chips button

Diffstat:
Mpkg/web/handlers/handlers.go | 7+++++++
Mpkg/web/public/views/pages/poker.gohtml | 5+++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -799,6 +799,13 @@ func PokerHomeHandler(c echo.Context) error { return c.Render(http.StatusOK, "poker", data) } + formName := c.Request().PostFormValue("form_name") + if formName == "reset_chips" { + authUser.ChipsTest = 1000 + authUser.DoSave(db) + return c.Redirect(http.StatusFound, c.Request().Referer()) + } + if config.PokerWithdrawEnabled.IsFalse() { data.Error = "withdraw temporarily disabled" return c.Render(http.StatusOK, "poker", data) diff --git a/pkg/web/public/views/pages/poker.gohtml b/pkg/web/public/views/pages/poker.gohtml @@ -23,6 +23,11 @@ <small>({{ .Data.XmrBalanceStagenet | fmtPiconero }} XMR)</small><br /> <br /> Free tables balance: {{ .Data.ChipsTest }} + <form method="post" class="d-inline ml-3"> + <input type="hidden" name="csrf" value="{{ .CSRF }}" /> + <input type="hidden" name="form_name" value="reset_chips" /> + <button class="btn btn-primary btn-sm">Reset chips</button> + </form> </div> <div class="mb-3"> <hr />