routes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: ISC Imports: 19 Imported by: 0

Documentation

Overview

Package routes defines all the handling functions for all the routes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller holds all the variables needed for routes to perform their logic

func New

func New(db *gorm.DB, c config.Config, bundle *i18n.Bundle) Controller

New creates a new instance of the routes.Controller

func (Controller) Activate

func (controller Controller) Activate(c *gin.Context)

Activate handles requests used to activate a users account

func (Controller) Admin

func (controller Controller) Admin(c *gin.Context)

Admin renders the admin dashboard

func (Controller) DefaultPageData

func (controller Controller) DefaultPageData(c *gin.Context) PageData

func (Controller) ForgotPassword

func (controller Controller) ForgotPassword(c *gin.Context)

ForgotPassword renders the HTML page where a password request can be initiated

func (Controller) ForgotPasswordPost

func (controller Controller) ForgotPasswordPost(c *gin.Context)

ForgotPasswordPost handles the POST request which requests a password reset and then renders the HTML page with the appropriate message

func (Controller) Index

func (controller Controller) Index(c *gin.Context)

Index renders the HTML of the index page

func (Controller) Login

func (controller Controller) Login(c *gin.Context)

Login renders the HTML of the login page

func (Controller) LoginPost

func (controller Controller) LoginPost(c *gin.Context)

LoginPost handles login requests and returns the appropriate HTML and messages

func (Controller) Logout

func (controller Controller) Logout(c *gin.Context)

Logout deletes the current user session and redirects the user to the index page

func (Controller) NoRoute

func (controller Controller) NoRoute(c *gin.Context)

NoRoute handles rendering of the 404 page

func (Controller) Register

func (controller Controller) Register(c *gin.Context)

Register renders the HTML content of the register page

func (Controller) RegisterPost

func (controller Controller) RegisterPost(c *gin.Context)

RegisterPost handles requests to register users and returns appropriate messages as HTML content

func (Controller) ResendActivation

func (controller Controller) ResendActivation(c *gin.Context)

ResendActivation renders the HTML page used to request a new activation email

func (Controller) ResendActivationPost

func (controller Controller) ResendActivationPost(c *gin.Context)

ResendActivationPost handles the post request for requesting a new activation email

func (Controller) ResetPassword

func (controller Controller) ResetPassword(c *gin.Context)

ResetPassword renders the HTML page for resetting the users password

func (Controller) ResetPasswordPost

func (controller Controller) ResetPasswordPost(c *gin.Context)

ResetPasswordPost handles post request used to reset users passwords

func (Controller) Search

func (controller Controller) Search(c *gin.Context)

Search renders the search HTML page and any search results

type Message

type Message struct {
	Type    string // success, warning, error, etc.
	Content string
}

Message holds a message which can be rendered as responses on HTML pages

type PageData

type PageData struct {
	Title           string
	Messages        []Message
	IsAuthenticated bool
	CacheParameter  string
	Trans           func(s string) string
}

PageData holds the default data needed for HTML pages to render

type ResetPasswordPageData

type ResetPasswordPageData struct {
	PageData
	Token string
}

ResetPasswordPageData defines additional data needed to render the reset password page

type SearchData

type SearchData struct {
	PageData
	Results []models.Website
	Prev    bool
	Next    bool
	PrevURL string
	NextURL string
}

SearchData holds additional data needed to render the search HTML page

Jump to

Keyboard shortcuts

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