Versions in this module Expand all Collapse all v1 v1.1.1 Oct 30, 2021 v1.1.0 Oct 25, 2021 v1.0.0 Apr 20, 2021 Changes in this version + var ErrAuth = errors.New("invalid credentials") + var ErrExists = errors.New("user exists") + var ErrTokenExpired = errors.New("token expired") + var MaxAge = 5 * 365 * 86400 + func Model(uu []*User) func(int) database.Model + func Select(col string, opts ...query.Option) query.Query + func WhereHandle(handle string) query.Option + type DeleteForm struct + Password string + func (f DeleteForm) Fields() map[string]string + func (f DeleteForm) Validate() error + type EmailForm struct + Email string + User *User + Users *Store + VerifyPassword string + func (f EmailForm) Fields() map[string]string + func (f EmailForm) Validate() error + type LoginForm struct + Handle string + Password string + RedirectURI string + func (f LoginForm) Fields() map[string]string + func (f LoginForm) Validate() error + type NewPasswordForm struct + Password string + Token string + VerifyPassword string + func (f NewPasswordForm) Fields() map[string]string + func (f NewPasswordForm) Validate() error + type PasswordForm struct + NewPassword string + OldPassword string + User *User + Users *Store + VerifyPassword string + func (PasswordForm) Fields() map[string]string + func (f PasswordForm) Validate() error + type PasswordResetForm struct + Email string + func (f PasswordResetForm) Fields() map[string]string + func (f PasswordResetForm) Validate() error + type RegisterForm struct + Email string + Password string + Username string + Users *Store + VerifyPassword string + func (f RegisterForm) Fields() map[string]string + func (f RegisterForm) Validate() error + type Store struct + func NewStore(db *sqlx.DB, mm ...database.Model) *Store + func (*Store) New() *User + func (s *Store) All(opts ...query.Option) ([]*User, error) + func (s *Store) Auth(handle, password string) (*User, error) + func (s *Store) Bind(_ ...database.Model) + func (s *Store) Create(email, username string, password []byte) (*User, string, error) + func (s *Store) Delete(id int64, password []byte) error + func (s *Store) Get(opts ...query.Option) (*User, error) + func (s *Store) Load(key string, vals []interface{}, load database.LoaderFunc) error + func (s *Store) RequestVerify(id int64) (string, error) + func (s *Store) ResetPassword(id int64) (string, error) + func (s *Store) Update(id int64, email string, cleanup bool, password []byte) error + func (s *Store) UpdatePassword(tok string, password []byte) error + func (s *Store) Verify(tok string) error + type User struct + Cleanup bool + CreatedAt time.Time + DeletedAt sql.NullTime + Email string + ID int64 + Password []byte + Permissions map[string]struct{} + UpdatedAt time.Time + Username string + Verified bool + func FromContext(ctx context.Context) (*User, bool) + func (*User) Bind(_ ...database.Model) + func (*User) Endpoint(_ ...string) string + func (u *User) IsZero() bool + func (u *User) JSON(_ string) map[string]interface{} + func (u *User) Primary() (string, int64) + func (u *User) SetPermission(perm string) + func (u *User) SetPrimary(id int64) + func (u *User) Values() map[string]interface{}