auth

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepo

type AuthRepo interface {
	CheckUserExistByEmail(ctx context.Context, email string) (bool, error)
	CheckUserExistByTelephone(ctx context.Context, telephoneAreaCode, telephone string) (bool, error)
	GetVerifyConfig(ctx context.Context) (*VerifyConfig, error)
	VerifyCaptcha(ctx context.Context, config *VerifyConfig, meta RequestMeta) error
	UserLogin(ctx context.Context, params *UserLoginParams) (*LoginResult, error)
	TelephoneLogin(ctx context.Context, params *TelephoneLoginParams) (*LoginResult, error)
	UserRegister(ctx context.Context, params *UserRegisterParams) (*LoginResult, error)
	TelephoneRegister(ctx context.Context, params *TelephoneRegisterParams) (*LoginResult, error)
	ResetPassword(ctx context.Context, params *ResetPasswordParams) (*LoginResult, error)
	TelephoneResetPassword(ctx context.Context, params *TelephoneResetPasswordParams) (*LoginResult, error)
}

type AuthUsecase

type AuthUsecase struct {
	// contains filtered or unexported fields
}

func NewAuthUsecase

func NewAuthUsecase(repo AuthRepo, logger log.Logger) *AuthUsecase

func (*AuthUsecase) CheckUser

func (uc *AuthUsecase) CheckUser(ctx context.Context, email string) (bool, error)

func (*AuthUsecase) CheckUserTelephone

func (uc *AuthUsecase) CheckUserTelephone(ctx context.Context, telephoneAreaCode, telephone string) (bool, error)

func (*AuthUsecase) ResetPassword

func (uc *AuthUsecase) ResetPassword(ctx context.Context, params *ResetPasswordParams) (*LoginResult, error)

func (*AuthUsecase) TelephoneLogin

func (uc *AuthUsecase) TelephoneLogin(ctx context.Context, params *TelephoneLoginParams) (*LoginResult, error)

func (*AuthUsecase) TelephoneRegister

func (uc *AuthUsecase) TelephoneRegister(ctx context.Context, params *TelephoneRegisterParams) (*LoginResult, error)

func (*AuthUsecase) TelephoneResetPassword

func (uc *AuthUsecase) TelephoneResetPassword(ctx context.Context, params *TelephoneResetPasswordParams) (*LoginResult, error)

func (*AuthUsecase) UserLogin

func (uc *AuthUsecase) UserLogin(ctx context.Context, params *UserLoginParams) (*LoginResult, error)

func (*AuthUsecase) UserRegister

func (uc *AuthUsecase) UserRegister(ctx context.Context, params *UserRegisterParams) (*LoginResult, error)

type LoginResult

type LoginResult struct {
	Token string
}

type RequestMeta

type RequestMeta struct {
	Identifier  string
	LoginType   string
	IP          string
	UserAgent   string
	CfToken     string
	CaptchaID   string
	CaptchaCode string
	SliderToken string
}

type ResetPasswordParams

type ResetPasswordParams struct {
	Email    string
	Password string
	Code     string
	Meta     RequestMeta
}

type TelephoneLoginParams

type TelephoneLoginParams struct {
	TelephoneAreaCode string
	Telephone         string
	Password          string
	TelephoneCode     string
	Meta              RequestMeta
}

type TelephoneRegisterParams

type TelephoneRegisterParams struct {
	TelephoneAreaCode string
	Telephone         string
	Password          string
	Invite            string
	Code              string
	Meta              RequestMeta
}

type TelephoneResetPasswordParams

type TelephoneResetPasswordParams struct {
	TelephoneAreaCode string
	Telephone         string
	Password          string
	Code              string
	Meta              RequestMeta
}

type UserLoginParams

type UserLoginParams struct {
	Email    string
	Password string
	Meta     RequestMeta
}

type UserRegisterParams

type UserRegisterParams struct {
	Email    string
	Password string
	Invite   string
	Code     string
	Meta     RequestMeta
}

type VerifyConfig

type VerifyConfig struct {
	CaptchaType                    string
	TurnstileSiteKey               string
	TurnstileSecret                string
	EnableUserLoginCaptcha         bool
	EnableUserRegisterCaptcha      bool
	EnableAdminLoginCaptcha        bool
	EnableUserResetPasswordCaptcha bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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