Documentation ¶
Index ¶
- Variables
- type User
- type UserManager
- func (s *UserManager) CheckGetUser(email string, pw string) (*User, error)
- func (s *UserManager) CheckPassword(user *User, pw string) error
- func (s *UserManager) Count() (int, error)
- func (s *UserManager) Delete(id int64) error
- func (s *UserManager) HasAdmins() (bool, error)
- func (s *UserManager) Insert(user *User, pw string) (*User, error)
- func (s *UserManager) Select(id int64) (*User, error)
- func (s *UserManager) SelectByEmail(email string) (*User, error)
- func (s *UserManager) Update(user *User) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHIDChanged = errors.New("HID is not allowed to be changed")
View Source
var ErrUserNotFound = errors.New("user not found")
TODO: bcrypt has a size limit of 72 bytes for the password. This should be checked and handled. Otherwise, switch to argon2id, and save the salt along with the hash in the table.
View Source
var ErrWrongPassword = errors.New("wrong password")
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { models.Record ID int64 `db:"pk,id"` Name string `db:"name"` Email string `db:"email"` Password string `db:"password"` UserData types.JsonMap `db:"user_data"` Avatar string `db:"avatar"` Expires types.DateTime `db:"expires"` LastSeen types.DateTime `db:"last_seen"` Role int `db:"role"` Active bool `db:"active"` Verified bool `db:"verified"` }
func (User) PrimaryKey ¶
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
func (*UserManager) CheckGetUser ¶
func (s *UserManager) CheckGetUser(email string, pw string) (*User, error)
func (*UserManager) CheckPassword ¶
func (s *UserManager) CheckPassword(user *User, pw string) error
TODO: Implement peppering of passwords So hackers cant't do anything if the table is stolen but the process space is intact
func (*UserManager) Count ¶
func (s *UserManager) Count() (int, error)
func (*UserManager) Delete ¶
func (s *UserManager) Delete(id int64) error
func (*UserManager) HasAdmins ¶
func (s *UserManager) HasAdmins() (bool, error)
func (*UserManager) SelectByEmail ¶
func (s *UserManager) SelectByEmail(email string) (*User, error)
func (*UserManager) Update ¶
func (s *UserManager) Update(user *User) error
Click to show internal directories.
Click to hide internal directories.