feat: register via json
also lots of refactoring (sorry)
This commit is contained in:
parent
782ffbbe6d
commit
d2fb0fa707
@ -50,14 +50,14 @@ func (ctx *Context) RegisterPost(w http.ResponseWriter, r *http.Request) {
|
||||
ctx.RedirectWithFlash(w, r, "/", "successful_registration", true)
|
||||
}
|
||||
|
||||
type jsonParams struct {
|
||||
type registerJsonParams struct {
|
||||
Username string
|
||||
NewPassword string
|
||||
ConfirmPassword string
|
||||
}
|
||||
|
||||
func (ctx *Context) RegisterPostJson(w http.ResponseWriter, r *http.Request) {
|
||||
var params jsonParams
|
||||
var params registerJsonParams
|
||||
err := decodeJsonParams(r, ¶ms)
|
||||
if err != nil {
|
||||
writeGeneralError(w, "Failed to decode json params: "+err.Error(), http.StatusBadRequest)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user