graphql

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongCredentials = erruser.New("wrong credentials", "Email or password is wrong")

Functions

This section is empty.

Types

type EmailSignInInput

type EmailSignInInput struct {
	Email    string                      `json:"email"`
	Password string                      `json:"password"`
	Captcha  *captchaAction.CaptchaToken `json:"captcha"`
}

type EmailSignUpInput

type EmailSignUpInput struct {
	Email    string                      `json:"email"`
	Password string                      `json:"password"`
	Captcha  *captchaAction.CaptchaToken `json:"captcha"`
	// The unique identifier of the user.
	// It will be used as the ID in the account table.
	// If empty, it will be generated automatically.
	ID uuid.UUID `json:"-"`
	// Additional user fields that may be stored in the account table.
	// It has to be set in the wrapper resolver instead of the GraphQL query if needed.
	UserInfo map[string]interface{} `json:"-"`
	// A set of roles that will be assigned to the user during registration.
	// It has to be set in the wrapper resolver instead of the GraphQL query if needed.
	// By default, the user will be assigned the role "user".
	Roles []string `json:"-"`
}

type Resolver

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

func NewResolver

func NewResolver(
	register *action.Register,
	login *action.Login,
	resetPassword *action.ResetPassword,
	changePassword *action.ChangePassword,
	checkCaptcha *captchaAction.CheckCaptcha,
) *Resolver

func (*Resolver) ChangePassword

func (r *Resolver) ChangePassword(ctx context.Context, input action.ChangePasswordInput) error

func (*Resolver) ConfirmResetPassword

func (r *Resolver) ConfirmResetPassword(
	ctx context.Context,
	input action.ConfirmResetPasswordInput,
) (string, error)

func (*Resolver) EmailSignIn

func (r *Resolver) EmailSignIn(ctx context.Context, input EmailSignInInput) (graphql.TokenPair, error)

func (*Resolver) EmailSignUp

func (r *Resolver) EmailSignUp(ctx context.Context, input EmailSignUpInput) (graphql.TokenPair, error)

EmailSignUp registers a new user via email and password. Errors: * github.com/go-modulus/auth/providers/email/action.ErrEmailAlreadyExists - the identity with such email already exists. * github.com/go-modulus/auth/providers/email/action.ErrUserAlreadyExists - overridden user provider says that the user already exists. * github.com/go-modulus/auth/providers/email/action.ErrCannotLogin - cannot log in automatically after registration.

func (*Resolver) RequestResetPassword

func (r *Resolver) RequestResetPassword(ctx context.Context, email string) (string, error)

Jump to

Keyboard shortcuts

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