utils

package
v0.0.0-...-03ce9ab Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoPasswordsMatch

func DoPasswordsMatch(hashedPassword, currPassword string) bool

DoPasswordsMatch Check if two passwords match using Bcrypt's CompareHashAndPassword which return nil on success and an error on failure.

func DropPrivileges

func DropPrivileges()

func HashPassword

func HashPassword(password string) (string, error)

adapted from https://www.gregorygaines.com/blog/how-to-properly-hash-and-salt-passwords-in-golang-bcrypt/ hashPassword Hash password using bcrypt and

func RandomString

func RandomString(length int) (string, error)

RandomString generates a string with the given length using crypt/rand

Types

type CustomError

type CustomError struct {
	Message string
}

func (*CustomError) Error

func (e *CustomError) Error() string

type MetaContent

type MetaContent struct {
	Username   string
	IsLoggedIn bool
	IsAdmin    bool
	Timestamp  string
	ErrorTitle string
	ErrorText  string
}

func GenMetaContent

func GenMetaContent(c *gin.Context) MetaContent

MetaContent collects all the values needed to render the templates that aren't specific to the view and combines them into a structure expected by the template

Jump to

Keyboard shortcuts

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