userutil

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomAvatarPath

func CustomAvatarPath(userID int64) string

CustomAvatarPath returns the absolute path of the user custom avatar file.

func DashboardURLPath

func DashboardURLPath(name string, isOrganization bool) string

DashboardURLPath returns the URL path to the user or organization dashboard.

func EncodePassword

func EncodePassword(password, salt string) string

EncodePassword encodes password using PBKDF2 SHA256 with given salt.

func GenerateActivateCode

func GenerateActivateCode(userID int64, email, name, password, rands string) string

GenerateActivateCode generates an activate code based on user information and the given email.

func GenerateRandomAvatar

func GenerateRandomAvatar(userID int64, name, email string) error

GenerateRandomAvatar generates a random avatar and stores to local file system using given user information.

func MailResendCacheKey

func MailResendCacheKey(userID int64) string

MailResendCacheKey returns the key used for caching mail resend.

func RandomSalt

func RandomSalt() (string, error)

RandomSalt returns randomly generated 10-character string that can be used as the user salt.

func SaveAvatar

func SaveAvatar(userID int64, data []byte) error

SaveAvatar saves the given avatar for the user.

func TwoFactorCacheKey

func TwoFactorCacheKey(userID int64, passcode string) string

TwoFactorCacheKey returns the key used for caching two factor passcode.

func ValidatePassword

func ValidatePassword(encoded, salt, password string) bool

ValidatePassword returns true if the given password matches the encoded version with given salt.

Types

This section is empty.

Jump to

Keyboard shortcuts

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