handlers

package
v0.0.0-...-7767d0b Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Decoder *schema.Decoder
	Store   *sessions.CookieStore
)

Functions

func AuthPass

func AuthPass(password, hash, salt string) bool

func Dev

func Dev(res http.ResponseWriter, req *http.Request)

list-view.html page

func DevList

func DevList(res http.ResponseWriter, req *http.Request)

list-view.html page

func GetListView

func GetListView(res http.ResponseWriter, req *http.Request)

list-view.html page

func GetLogin

func GetLogin(res http.ResponseWriter, req *http.Request)

Get login.html form

func GetNewAccount

func GetNewAccount(res http.ResponseWriter, req *http.Request)

Get register.html form

func GetUserTasks

func GetUserTasks(res http.ResponseWriter, req *http.Request)

Handler for getting all a user's tasks; apart of post login screen

func Index

func Index(res http.ResponseWriter, req *http.Request)

Get index.html form

func NewPass

func NewPass(password string) (string, string)

func PostLogin

func PostLogin(res http.ResponseWriter, req *http.Request)

Handler for authenticating a user

func PostLogout

func PostLogout(res http.ResponseWriter, req *http.Request)

Deletes a user's session logging them out

func PostNewAccount

func PostNewAccount(res http.ResponseWriter, req *http.Request)

Handler for making a new user

func PostNewTask

func PostNewTask(res http.ResponseWriter, req *http.Request)

Handler for creating a new task if a user is authed

func PostUpdateTask

func PostUpdateTask(res http.ResponseWriter, req *http.Request)

Handler for updating a task's data

func RequireLogin

func RequireLogin(handler http.Handler) http.HandlerFunc

RequireLogin is a simple middleware which checks to see if the user is currently logged in. If not, the function returns a 302 redirect to the login page.

func Use

func Use(handler http.HandlerFunc, mid ...func(http.Handler) http.HandlerFunc) http.HandlerFunc

Use allows us to stack middleware to process the request Example taken from https://github.com/gorilla/mux/pull/36#issuecomment-25849172

Types

type CreateAccountForm

type CreateAccountForm struct {
	Email     string
	FirstName string
	LastName  string
	Password  string
	Password2 string
}

Struct used for registering a new user

func (*CreateAccountForm) Validate

func (form *CreateAccountForm) Validate() (err error)

Validate function for CreateAccountForm

type FormValidationError

type FormValidationError struct {
	What string
}

Type to be returned when there is an error parsing a form

func (FormValidationError) Error

func (err FormValidationError) Error() string

Error string function for FormValidationError

type JsonResponse

type JsonResponse struct {
	Name string
	Data interface{}
}

type LoginForm

type LoginForm struct {
	Email      string
	Password   string
	RememberMe bool
}

Struct used for logging in a user

func (*LoginForm) Validate

func (form *LoginForm) Validate() (err error)

Validate function for LoginForm

Jump to

Keyboard shortcuts

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