heyfyiserver

package
v0.0.0-...-2feadb7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackgroundVoteGiver

func BackgroundVoteGiver()

func ConvertBool

func ConvertBool(value string) reflect.Value

func GetCreateFactUrl

func GetCreateFactUrl() string

func GetDeleteFactUrl

func GetDeleteFactUrl(factId int64) string

func GetHomeUrl

func GetHomeUrl() string

func GetListFactUrl

func GetListFactUrl() string

func GetRequestPasswordResetUrl

func GetRequestPasswordResetUrl() string

func GetSignInUrl

func GetSignInUrl() string

func GetSignOutUrl

func GetSignOutUrl() string

func GetSignUpUrl

func GetSignUpUrl() string

func GetViewFactUrl

func GetViewFactUrl(factId int64) string

func ReturnJSON

func ReturnJSON(rw web.ResponseWriter, object interface{})

func StartServer

func StartServer(serverAddress string, cookieStoreSalt string)

func TruncateString

func TruncateString(s string, charLimit int) string

Smart truncation function

Types

type AnyStorer

type AnyStorer interface {
	account.AccountStorer
	fact.FactStorer
}

type Context

type Context struct {
	ErrorMessages        []string
	NotificationMessages []string
	Data                 interface{}
	Store                *sessions.CookieStore
	Account              *account.Account
	Storage              AnyStorer
}

Used in all requests

func (*Context) AssignStorageMiddleware

func (c *Context) AssignStorageMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

func (*Context) AssignTemplatesAndSessionsMiddleware

func (c *Context) AssignTemplatesAndSessionsMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

func (*Context) BeginPasswordResetRequestHandler

func (c *Context) BeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) CheckFailedRequestObject

func (c *Context) CheckFailedRequestObject(rw web.ResponseWriter, req *web.Request) interface{}

This function returns just one "flash" failed request object for a session. Any other request objects that were stored will be removed without retrieval. It allows for users to amend bad forms without needing to retype all the data

func (*Context) CreateFactHandler

func (c *Context) CreateFactHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DeleteFactHandler

func (c *Context) DeleteFactHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoBeginPasswordResetRequestHandler

func (c *Context) DoBeginPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoCreateFactHandler

func (c *Context) DoCreateFactHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoDeleteFactHandler

func (c *Context) DoDeleteFactHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoPasswordResetRequestHandler

func (c *Context) DoPasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoSignInRequestHandler

func (c *Context) DoSignInRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoSignUpHandler

func (c *Context) DoSignUpHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) DoVerificationRequestHandler

func (c *Context) DoVerificationRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) GetErrorMessagesMiddleware

func (c *Context) GetErrorMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

This function returns any flash error messages that have been saved. Upon retrieving them, they will be deleted from the session (as they are "flash" session variables)

func (*Context) GetNotificationMessagesMiddleware

func (c *Context) GetNotificationMessagesMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

This function returns any flash notification messages that have been saved. Upon retrieving them, they will be deleted from the session (as they are "flash" session variables)

func (*Context) HomeHandler

func (c *Context) HomeHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) ListFactsHandler

func (c *Context) ListFactsHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) LoadUserMiddleware

func (c *Context) LoadUserMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

func (*Context) PasswordResetRequestHandler

func (c *Context) PasswordResetRequestHandler(rw web.ResponseWriter, req *web.Request)

func (*Context) RequireAccountMiddleware

func (c *Context) RequireAccountMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

func (*Context) SetErrorMessage

func (c *Context) SetErrorMessage(rw web.ResponseWriter, req *web.Request, err string)

This function allows for a handler to set an error message as a "Flash" message which can be shown to the user in a later request (via a different handler) - it stores them in a session variable

func (*Context) SetFailedRequestObject

func (c *Context) SetFailedRequestObject(rw web.ResponseWriter, req *web.Request, requestedObject interface{})

This function allows us to store a bad request from a form (eg not meeting the regex for the NHI parameter of system.Patient) so it can be recalled later for them to amend it

func (*Context) SetNotificationMessage

func (c *Context) SetNotificationMessage(rw web.ResponseWriter, req *web.Request, notification string)

This function allows for a handler to set a notification message as a "Flash" message which can be shown to the user in a later request (via a different handler) - it stores them in a session variable

func (*Context) SignUpHandler

func (c *Context) SignUpHandler(rw web.ResponseWriter, req *web.Request)

This handler is for the registration of an account

func (*Context) ViewFactHandler

func (c *Context) ViewFactHandler(rw web.ResponseWriter, req *web.Request)

type CreateAccount

type CreateAccount struct {
	Email           string
	Password        string
	ConfirmPassword string
	TermsCB         bool
	Nickname        string
}

type LoggedInContext

type LoggedInContext struct {
	*Context
}

func (*LoggedInContext) DoSignOutRequestHandler

func (c *LoggedInContext) DoSignOutRequestHandler(rw web.ResponseWriter, req *web.Request)

This handler performs the logout request

func (*LoggedInContext) ModerateFactHandler

func (c *LoggedInContext) ModerateFactHandler(rw web.ResponseWriter, req *web.Request)

func (*LoggedInContext) VoteOnFactHandler

func (c *LoggedInContext) VoteOnFactHandler(rw web.ResponseWriter, req *web.Request)

type LoginRequestForm

type LoginRequestForm struct {
	Email    string
	Password string
	Remember bool
}

type PasswordResetRequestForm

type PasswordResetRequestForm struct {
	Email string
}

type ResetPasswordForm

type ResetPasswordForm struct {
	Password        string
	ConfirmPassword string
}

type URL

type URL string
const (
	HomeUrl                 URL = "/"
	ListFactUrl             URL = "/fact"
	CreateFactUrl           URL = "/fact/create"
	ViewFactUrl             URL = "/fact/view/:factId"
	DeleteFactUrl           URL = "/fact/delete/:factId"
	VoteOnFactUrl           URL = "/api/vote"
	ModerateFactUrl         URL = "/api/moderate"
	SignUpUrl               URL = "/signup"
	SignInUrl               URL = "/signin"
	SignOutUrl              URL = "/signout"
	VerificationUrl         URL = "/verify/:accountId/:verificationCode"
	RequestPasswordResetUrl URL = "/reset"
	ResetPasswordUrl        URL = "/reset/:accountId/:resetVerificationCode"
)

func (URL) Make

func (u URL) Make(param ...string) string

func (URL) String

func (u URL) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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