owntickets

package
v0.0.0-...-a19e32c Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Templates embed.FS

Functions

func StrToBool

func StrToBool(s string) bool

Types

type Config

type Config struct {
	PasswordHash                     string `json:"passwordHash"`
	RequirePasswordForTicketCreation bool   `json:"requirePasswordForTicketCreation"`
	TicketCreationPasswordHash       string `json:"ticketCreationPasswordHash"`
	Database                         string `json:"database"`
}

func (*Config) LoadFromEnv

func (c *Config) LoadFromEnv()

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(path string) error

func (*Config) Validate

func (c *Config) Validate() error

type OwnTickets

type OwnTickets struct {
	Config   Config
	Database *gorm.DB
	Router   http.Handler
	Cookie   *securecookie.SecureCookie

	TicketCreateTemplate *pongo2.Template
	TicketViewTemplate   *pongo2.Template
	ErrorTemplate        *pongo2.Template
	LoginTemplate        *pongo2.Template
	AdminTemplate        *pongo2.Template
}

func (*OwnTickets) AdminPage

func (o *OwnTickets) AdminPage(w http.ResponseWriter, r *http.Request)

func (*OwnTickets) CheckAdminCookie

func (o *OwnTickets) CheckAdminCookie(w http.ResponseWriter, r *http.Request, require bool) (isAdmin bool)

func (*OwnTickets) CreateTicketPage

func (o *OwnTickets) CreateTicketPage(w http.ResponseWriter, r *http.Request)

func (*OwnTickets) Error

func (o *OwnTickets) Error(w http.ResponseWriter, code int, codeMsg string, err string)

func (*OwnTickets) LoginPage

func (o *OwnTickets) LoginPage(w http.ResponseWriter, r *http.Request)

func (*OwnTickets) LogoutPage

func (o *OwnTickets) LogoutPage(w http.ResponseWriter, r *http.Request)

func (*OwnTickets) Run

func (o *OwnTickets) Run() error

func (*OwnTickets) SetAdminCookie

func (o *OwnTickets) SetAdminCookie(w http.ResponseWriter, r *http.Request, isAdmin bool)

func (*OwnTickets) SetupCookies

func (o *OwnTickets) SetupCookies() (err error)

func (*OwnTickets) SetupDatabase

func (o *OwnTickets) SetupDatabase() error

func (*OwnTickets) SetupRouter

func (o *OwnTickets) SetupRouter() error

func (*OwnTickets) SetupTemplates

func (o *OwnTickets) SetupTemplates() (err error)

func (*OwnTickets) ViewTicketPage

func (o *OwnTickets) ViewTicketPage(w http.ResponseWriter, r *http.Request)

type TicketForm

type TicketForm struct {
	Name     string `schema:"name"`
	Email    string `schema:"email"`
	Title    string `schema:"title"`
	Content  string `schema:"content"`
	Priority int    `schema:"priority"`
	Password string `schema:"password"`
}

func (*TicketForm) Validate

func (t *TicketForm) Validate() map[string]string

Jump to

Keyboard shortcuts

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