Documentation ¶
Overview ¶
Package user provides services and types for User-related data.
Package user provides services and types for User-related data.
Index ¶
- Variables
- type Login
- type PaypalMailAddrSetter
- type PublicUser
- type Registration
- type Service
- func (s *Service) Authenticate(l *Login) (uint64, error)
- func (s *Service) ConfirmMailAddr(token string) error
- func (s *Service) Get(id uint64) (PublicUser, error)
- func (s *Service) Register(r *Registration) (bool, error)
- func (s *Service) SetPaypalMailAddr(id uint64, setter PaypalMailAddrSetter) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrUserExists = errors.New("the given mail address already exists") ErrPasswordInvalid = errors.New("the given password is invalid") ErrPasswordIncorrect = errors.New("the given password is not correct") ErrUserNotStored = errors.New("the user could not be registered") ErrUserNotFound = errors.New("the user could not be found") ErrConfirmationMailNotSent = errors.New("confirmation mail could not be sent") ErrTokenInvalid = errors.New("the confirmation token is invalid") )
Functions ¶
This section is empty.
Types ¶
type PaypalMailAddrSetter ¶
type PaypalMailAddrSetter struct {
PaypalMailAddr string `json:"paypal_mail_addr"`
}
PaypalMailAddrSetter is a setter type for the PaypalMailAddr property.
type PublicUser ¶
PublicUser is the public representation of an user (i. e. profile).
type Registration ¶
type Registration struct { MailAddr string `json:"mail_addr"` Name string `json:"name"` PaypalMailAddr string `json:"paypal_mail_addr"` Password string `json:"password"` }
Registration represents a user registration.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service executes user-related business logic and use cases. It is also responsible for accessing the model storage under consideration of all business rules.
func NewService ¶
NewService creates a new Service instance utilizing the given storage objects. The storage objects need to be ready to use for the service.
func (*Service) Authenticate ¶
Authenticate will authenticate a user by comparing given login data with the stored password hash. Authenticate is not responsible for creating a session, this will be done by the session manager if the authentication was successful.
func (*Service) ConfirmMailAddr ¶
ConfirmMailAddr will confirm the mail address (and therefore the user account) that is associated with the given token.
func (*Service) Get ¶
func (s *Service) Get(id uint64) (PublicUser, error)
Get returns all relevant meta data for an user identified by id.
func (*Service) Register ¶
func (s *Service) Register(r *Registration) (bool, error)
Register stores a new user, creates a confirmation token and sends a corresponding confirmation e-mail.
func (*Service) SetPaypalMailAddr ¶
func (s *Service) SetPaypalMailAddr(id uint64, setter PaypalMailAddrSetter) error
SetPaypalMailAddr sets the PayPal mail address of the user identified by id.