views

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(c *gin.Context, db *gorm.DB, cfg *config.Config)

func AuthorizeUser

func AuthorizeUser(c *gin.Context, db *gorm.DB, cfg *config.Config)

func CreateGroup

func CreateGroup(c *gin.Context, db *gorm.DB)
func CreateLink(c *gin.Context, db *gorm.DB)

func CreateUser

func CreateUser(c *gin.Context, db *gorm.DB, cfg *config.Config)

func DeleteGroup

func DeleteGroup(c *gin.Context, db *gorm.DB)
func DeleteLink(c *gin.Context, db *gorm.DB)

func GetGinEngine

func GetGinEngine(cfg *config.Config, db *gorm.DB) *gin.Engine

func GetJWTToken

func GetJWTToken(cfg *config.Config) (string, error)

func RequireAuth

func RequireAuth(c *gin.Context, cfg *config.Config) (*jwt.RegisteredClaims, error)

Requires the user to log in before viewing the page. Returns error if the user is not authorized. If `nil` is returned instead of an error, it is safe to display protected content.

func SecurityHeadersMiddleware

func SecurityHeadersMiddleware(c *gin.Context)

Adds several headers to the response to improve security. For example, headers prevent embedding a site and passing information about the referrer.

func SetTokenCookie

func SetTokenCookie(c *gin.Context, token string)

Save token for one day in cookies

func ShowError

func ShowError(c *gin.Context, err error)

func ShowLoginForm

func ShowLoginForm(c *gin.Context)

func ShowMainPage

func ShowMainPage(c *gin.Context, db *gorm.DB)

func ShowRegistrationForm

func ShowRegistrationForm(c *gin.Context, db *gorm.DB)

func ShowSettings

func ShowSettings(c *gin.Context, db *gorm.DB)

func UpdateGroup

func UpdateGroup(c *gin.Context, db *gorm.DB)
func UpdateLink(c *gin.Context, db *gorm.DB)

Types

This section is empty.

Jump to

Keyboard shortcuts

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