auth

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleViewer  = 1
	RoleEditor  = 2
	RoleManager = 3
	RoleAdmin   = 4
)

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(db *sql.DB, email, password string) (*models.User, error)

func CheckPassword

func CheckPassword(password, hash string) bool

func DeleteSession

func DeleteSession(db *sql.DB, token string) error

func GetUserID

func GetUserID(db *sql.DB, token string) (int, error)

func HashPassword

func HashPassword(password string) (string, error)

Types

type Session

type Session struct {
	Token     string
	UserID    int
	CompanyID int
	ExpiresAt time.Time
}

func CreateSession

func CreateSession(db *sql.DB, userID int, companyID int) (*Session, error)

func GetSession

func GetSession(db *sql.DB, token string) (*Session, error)

Jump to

Keyboard shortcuts

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