Documentation ¶
Index ¶
- Variables
- func CurrentUser(ctx context.Context) (m monad.Maybe[UserID])
- func WithUserID(ctx context.Context, uid UserID) context.Context
- type APIKey
- type Email
- type KeyGenerator
- type PasswordHash
- type PasswordHasher
- type UniqueEmail
- type User
- type UserEmailChanged
- type UserID
- type UserPasswordChanged
- type UserRegistered
- type UsersReader
- type UsersWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmailAlreadyTaken = apperr.New("email_already_taken") ErrInvalidEmailOrPassword = apperr.New("invalid_email_or_password") ErrAdminAccountRequired = errors.New(`seelf requires a default user to be created but your database looks empty. Please set the SEELF_ADMIN_EMAIL and SEELF_ADMIN_PASSWORD environment variables and relaunch the command, for example: $ SEELF_ADMIN_EMAIL=admin@example.com SEELF_ADMIN_PASSWORD=admin seelf serve Please note this is a one time only action`) )
View Source
var ErrInvalidEmail = apperr.New("invalid_email")
Functions ¶
func CurrentUser ¶
Retrieve the current user attached to the given context if any.
Types ¶
type KeyGenerator ¶
type PasswordHash ¶
type PasswordHash string
type PasswordHasher ¶
type PasswordHasher interface { Hash(string) (PasswordHash, error) Compare(string, PasswordHash) error }
type UniqueEmail ¶
type UniqueEmail Email
type User ¶
func NewUser ¶
func NewUser(email UniqueEmail, password PasswordHash, key APIKey) (u User)
func (*User) HasPassword ¶
func (u *User) HasPassword(password PasswordHash)
Updates the user password
func (User) Password ¶
func (u User) Password() PasswordHash
type UserEmailChanged ¶
type UserEmailChanged struct { bus.Notification ID UserID Email UniqueEmail }
func (UserEmailChanged) Name_ ¶ added in v1.2.0
func (UserEmailChanged) Name_() string
type UserPasswordChanged ¶
type UserPasswordChanged struct { bus.Notification ID UserID Password PasswordHash }
func (UserPasswordChanged) Name_ ¶ added in v1.2.0
func (UserPasswordChanged) Name_() string
type UserRegistered ¶
type UserRegistered struct { bus.Notification ID UserID Email UniqueEmail Password PasswordHash Key APIKey RegisteredAt time.Time }
func (UserRegistered) Name_ ¶ added in v1.2.0
func (UserRegistered) Name_() string
type UsersReader ¶
type UsersReader interface { GetUsersCount(context.Context) (uint, error) GetIDFromAPIKey(context.Context, APIKey) (UserID, error) IsEmailUnique(context.Context, Email) (UniqueEmail, error) IsEmailUniqueForUser(context.Context, UserID, Email) (UniqueEmail, error) GetByEmail(context.Context, Email) (User, error) GetByID(context.Context, UserID) (User, error) }
Click to show internal directories.
Click to hide internal directories.