controllers

package
v0.0.0-...-c9dde97 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieSession = "session"
)

Variables

This section is empty.

Functions

func FAQ

func FAQ(tpl Template) http.HandlerFunc

func StaticHandler

func StaticHandler(tpl Template) http.HandlerFunc

Types

type Galleries

type Galleries struct {
	Templates struct {
		New   Template
		Edit  Template
		Index Template
		Show  Template
	}
	GalleryService *models.GalleryService
}

func (Galleries) Create

func (g Galleries) Create(w http.ResponseWriter, r *http.Request)

func (Galleries) Delete

func (g Galleries) Delete(w http.ResponseWriter, r *http.Request)

func (Galleries) Edit

func (g Galleries) Edit(w http.ResponseWriter, r *http.Request)

func (Galleries) Index

func (g Galleries) Index(w http.ResponseWriter, r *http.Request)

func (Galleries) New

func (g Galleries) New(w http.ResponseWriter, r *http.Request)

func (Galleries) Show

func (g Galleries) Show(w http.ResponseWriter, r *http.Request)

func (Galleries) Update

func (g Galleries) Update(w http.ResponseWriter, r *http.Request)

type Template

type Template interface {
	Execute(w http.ResponseWriter, r *http.Request, data interface{}, errs ...error)
}

type UserMiddleware

type UserMiddleware struct {
	SessionService *models.SessionService
}

func (UserMiddleware) RequireUser

func (umw UserMiddleware) RequireUser(next http.Handler) http.Handler

If user found in context, process. Else redirect to signing. Protects access to downstream handlers

func (UserMiddleware) SetUser

func (umw UserMiddleware) SetUser(next http.Handler) http.Handler

If user has cookies, add current user to context for downstream handlers

type Users

type Users struct {
	Templates struct {
		New            Template
		SignIn         Template
		ForgotPassword Template
		CheckYourEmail Template
		ResetPassword  Template
	}
	SessionService       *models.SessionService
	UserService          *models.UserService
	PasswordResetService *models.PasswordResetService
	EmailService         *models.EmailService
}

func (Users) Create

func (u Users) Create(w http.ResponseWriter, r *http.Request)

Create new user from registration form

func (Users) CurrentUser

func (u Users) CurrentUser(w http.ResponseWriter, r *http.Request)

Serve current user info

func (Users) ForgotPassword

func (u Users) ForgotPassword(w http.ResponseWriter, r *http.Request)

Serve reset password page

func (Users) New

func (u Users) New(w http.ResponseWriter, r *http.Request)

Serve user registration

func (Users) ProcessForgotPassword

func (u Users) ProcessForgotPassword(w http.ResponseWriter, r *http.Request)

Handle password reset submission

func (Users) ProcessResetPassword

func (u Users) ProcessResetPassword(w http.ResponseWriter, r *http.Request)

func (Users) ProcessSignIn

func (u Users) ProcessSignIn(w http.ResponseWriter, r *http.Request)

Verify user credentials

func (Users) ResetPassword

func (u Users) ResetPassword(w http.ResponseWriter, r *http.Request)

func (Users) SignIn

func (u Users) SignIn(w http.ResponseWriter, r *http.Request)

Server user signin

func (Users) SignOut

func (u Users) SignOut(w http.ResponseWriter, r *http.Request)

Sign current user out

Jump to

Keyboard shortcuts

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