auth

package module
v0.0.0-...-0d0299b Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthApp = gorf.GorfBaseApp{
	Name:         "auth",
	RouteHandler: Urls,
	SetUpHandler: setup,
}
View Source
var AuthSettings = AuthAppSettings{
	NewUserState:      activateUserOnCreation,
	EmailVerification: skipEmailVerification,
	NewUserAdminState: defaultAdminStatus,
}

Functions

func LoginRequiredMiddleware

func LoginRequiredMiddleware(ctx *gin.Context)

func Urls

func Urls(r *gin.Engine)

func UserLogin

func UserLogin(ctx *gin.Context)

func UserProfile

func UserProfile(ctx *gin.Context)

func UserSignUp

func UserSignUp(ctx *gin.Context)

Types

type AuthAppSettings

type AuthAppSettings struct {
	NewUserState             AuthState
	NewUserAdminState        AuthState
	EmailVerification        AuthState
	EmailVerificationBackend AuthEmailVerificationBackend
}

type AuthEmailVerificationBackend

type AuthEmailVerificationBackend interface {
	PrepareMail(user *User) error
	SendMail() error
}

type AuthState

type AuthState bool

type User

type User struct {
	gorm.Model
	FirstName string `json:"first_name" binding:"required"`
	LastName  string `json:"last_name" binding:"required"`
	Email     string `json:"email" binding:"required" gorm:"unique;not null"`
	Password  string `json:"-" binding:"required"`
	Active    bool   `json:"active"`
	Admin     bool   `json:"admin"`
}

func GetUser

func GetUser(ctx *gin.Context) (User, error)

func (*User) FullName

func (user *User) FullName() string

Jump to

Keyboard shortcuts

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