userhandler

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2024 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbHandler

type DbHandler struct {
	// contains filtered or unexported fields
}

DbHandler Is an opinionated user management handler for an http server it uses uses the same DB user manager to manage user creation, deletion, etc. todo add factory to make sure the logger is not nil todo rename to something that makes more sense

func NewDbHandler

func NewDbHandler(db *gorm.DB, opts user.ManagerOpts) (*DbHandler, error)

func NewHandler

func NewHandler(db *user.DbManager) (*DbHandler, error)

func (DbHandler) CreateUserForm

func (h DbHandler) CreateUserForm() func(w http.ResponseWriter, r *http.Request)

CreateUserForm returns a handler function to print a simple create user form

func (DbHandler) CreateUserHandleForm

func (h DbHandler) CreateUserHandleForm() func(w http.ResponseWriter, r *http.Request)

CreateUserHandleForm returns a handler function to process user creation post form request

func (DbHandler) UserHandler

func (h DbHandler) UserHandler(base string) *http.ServeMux

UserHandler returns a full-fledged user handling mux it is not intended as real use, but rather as an example on how to use all or part of the user manager handler it can be hooked in into any other mux like this: rootMux.Handle("/top_path/", http.StripPrefix("/top_path", subMux))

type FormPostData

type FormPostData struct {
	Name     string
	Pw       string
	Redirect string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL