Documentation ¶
Index ¶
- Variables
- func AuthPass(password, hash, salt string) bool
- func Dev(res http.ResponseWriter, req *http.Request)
- func DevList(res http.ResponseWriter, req *http.Request)
- func GetListView(res http.ResponseWriter, req *http.Request)
- func GetLogin(res http.ResponseWriter, req *http.Request)
- func GetNewAccount(res http.ResponseWriter, req *http.Request)
- func GetUserTasks(res http.ResponseWriter, req *http.Request)
- func Index(res http.ResponseWriter, req *http.Request)
- func NewPass(password string) (string, string)
- func PostLogin(res http.ResponseWriter, req *http.Request)
- func PostLogout(res http.ResponseWriter, req *http.Request)
- func PostNewAccount(res http.ResponseWriter, req *http.Request)
- func PostNewTask(res http.ResponseWriter, req *http.Request)
- func PostUpdateTask(res http.ResponseWriter, req *http.Request)
- func RequireLogin(handler http.Handler) http.HandlerFunc
- func Use(handler http.HandlerFunc, mid ...func(http.Handler) http.HandlerFunc) http.HandlerFunc
- type CreateAccountForm
- type FormValidationError
- type JsonResponse
- type LoginForm
Constants ¶
This section is empty.
Variables ¶
var ( Decoder *schema.Decoder Store *sessions.CookieStore )
Functions ¶
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 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{} }