credentials

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

HashPassword returns the bcrypt hash of the password

func New

func New(db *gorm.DB, opts ...Opt) *credentialsProvider

New creates a new GitHub provider.

Types

type Opt

type Opt func(*credentialsProvider)

Opt is a function that configures the credentials provider.

type User

type User struct {
	// ID is the unique identifier of the user.
	ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
	// Name is the name of the user.
	Name string `gorm:"size:255"`
	// Email is the email of the user.
	Email string `gorm:"type:varchar(100);unique_index"`
	// HashedPassword is the hashed password of the user.
	HashedPassword []byte
	// Active is true if the user is active.
	Active bool
	// CreatedAt is the creation time of the user.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the update time of the user.
	UpdatedAt time.Time `json:"updated_at"`
	// DeletedAt is the deletion time of the user.
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

func (*User) SetNewPassword

func (user *User) SetNewPassword(password string) error

SetNewPassword set a new hashsed password to user.

Jump to

Keyboard shortcuts

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