Documentation ¶
Index ¶
- func CreateUser(username string, email string, password string, db *sqlx.DB) error
- func OpenDB() *sqlx.DB
- type Episode
- type Series
- type User
- func (u *User) CheckPassword(password string) (bool, error)
- func (u *User) Confirm(cc string) error
- func (u *User) ConfirmPasswordReset(prCode string) error
- func (u *User) GenAuthToken() (*string, error)
- func (u *User) GenConfirmationCode() (*string, error)
- func (u *User) Save(validate bool) error
- func (u *User) StartPasswordReset() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser creates a new, validated user
Types ¶
type Episode ¶
type Series ¶
type Series struct { ID int64 `json:"id"` Title string `json:"title"` Description string `json:"description"` PosterURL string `json:"poster"` Seasons int `json:"seasons"` }
func GetAllSeries ¶
type User ¶
type User struct { ID int64 Username string Email string PasswordHash string Admin bool `json:"-"` PasswordReset bool `json:"-"` Confirmed bool `json:"-"` }
User model
func CheckToken ¶
CheckToken checks an authentication token user/expiry/etc against db
func (*User) CheckPassword ¶
CheckPassword checks a users password against the password hash and returns a bool and any errors
func (*User) ConfirmPasswordReset ¶
ConfirmPasswordReset sends a password reset email and sets passwordReset to true
func (*User) GenAuthToken ¶
GenAuthToken generates a signed authentication token for the user
func (*User) GenConfirmationCode ¶
GenConfirmationCode creates a confirmationcode using crypto
func (*User) Save ¶
Save a user to the database, optionally validating - ensures no duplicates and updates any existing record with the same ID nothing persists to the database but (*User).Save()
func (*User) StartPasswordReset ¶
StartPasswordReset sends a password reset email and sets passwordReset to true