utils

package
v0.0.0-...-a8fe247 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorParseClaim error
View Source
var ErrorParseToken error
View Source
var ErrorTokenExpired error
View Source
var ErrorTokenMalformed error
View Source
var ErrorTokenRequired error

Functions

func ImageCheckFilename

func ImageCheckFilename(filename string) bool

func ImageCompare

func ImageCompare(a image.Image, b image.Image) (float32, error)

func ImageDelete

func ImageDelete(filename string, keepThumb bool)

if failed, only log the error

func ImageGetFullPath

func ImageGetFullPath(filename string, thumb bool) string

need check filename if the filename comes from user

func ImageRandomFilename

func ImageRandomFilename() string

func ImageSave

func ImageSave(image image.Image) (string, error)

func Init

func Init() error

func RandStringBytes

func RandStringBytes(n int) string

func SendEmail

func SendEmail(e, s string, b *string)

SendEmail takes an email address, a subject and a pointer of the body message

func SendVerificationEmail

func SendVerificationEmail(e, vc string)

SendVerificationEmail sends verification email to new user, it takes an email address and the verification code

func TokenGenerate

func TokenGenerate(id string) string

TokenGenerate output the JWT token and it takes a user id and returns a string representing the token

func TokenValidate

func TokenValidate(t string) (string, error)

TokenValidate validates the token. It takes a token and returns a string representing the user Id and an error if it occurs. Possible errors are: ErrorParseClaim, ErrorParseToken, ErrorTokenExpired, ErrorTokenMalformed

Types

This section is empty.

Jump to

Keyboard shortcuts

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