utils

package
v0.0.0-...-d96fec9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PW_SALT_BYTES = 32
	PW_HASH_BYTES = 64
)

Variables

View Source
var FuncMap = template.FuncMap{
	"replace": func(input, from, to string) string {
		return strings.Replace(input, from, to, -1)
	},
	"card_text": func(input models.Card) string {
		return input.GetText()
	},
	"card_dash": func(input models.Card) string {
		return strings.Replace(input.GetText(), "_", "<div class=\"long-dash\"></div>", -1)
	},
	"card_black": func(input models.Card) bool {
		return input.GetColor() == models.BLACK_CARD
	},
	"long_text": func(input string) bool {
		return len(input) > 100
	},
	"is_player": func(user models.User) bool {
		return user.UserType == models.PlayerType
	},
	"is_admin": func(user models.User) bool {
		return user.IsAdmin()
	},
	"format_date": func(date time.Time) string {
		return date.Format("2 Jan 2006, 15:04:01")
	},
}

Functions

func CheckPassword

func CheckPassword(hash string, password string) bool

func GetUsername

func GetUsername(c echo.Context) string

func HashPassword

func HashPassword(password string) string

func InitDB

func InitDB() *gorp.DbMap

func IsLoggedIn

func IsLoggedIn(c echo.Context) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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