account

package
v0.0.0-...-8bff5d1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler handles account endpoints.

func NewHandler

func NewHandler(accountS Service, userS user.Service, emailer email.Emailer) Handler

NewHandler returns a new account handler.

func (*Handler) ChangeEmail

func (h *Handler) ChangeEmail() http.HandlerFunc

ChangeEmail changes the user email to the specified one.

func (*Handler) ChangePassword

func (h *Handler) ChangePassword() http.HandlerFunc

ChangePassword updates the user password.

func (*Handler) SendChangeConfirmation

func (h *Handler) SendChangeConfirmation() http.HandlerFunc

SendChangeConfirmation takes the new email and sends an email confirmation.

func (*Handler) SendEmailValidation

func (h *Handler) SendEmailValidation(u user.Service) http.HandlerFunc

SendEmailValidation saves the user email into the validated list. Once in the validated list, the user is able to log in.

type Service

type Service interface {
	ChangeEmail(ctx context.Context, id, newEmail, token string) error
	ChangePassword(ctx context.Context, id, oldPass, newPass string) error
	ValidateUserEmail(ctx context.Context, id, confirmationCode string, verified bool) error
}

Service provides user account operations.

func NewService

func NewService(db *sqlx.DB) Service

NewService creates an account service.

Jump to

Keyboard shortcuts

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