Documentation ¶
Index ¶
- func AddUser(clients *conn.Clients, ur *Registration, rr *RecaptchaResponse) (int64, error)
- func ChangePassword(clients *conn.Clients, idUser int64, newPassword string) error
- func DeleteAbout(clients *conn.Clients, idUser int64) error
- func GetUsername(clients *conn.Clients, idUser int64) (string, error)
- func RouteAuth(clients *conn.Clients) chi.Router
- func RouteUser(clients *conn.Clients) chi.Router
- func UpdateAbout(clients *conn.Clients, idUser int64, a *About) error
- type About
- type IDs
- type Login
- type PasswordChange
- type RecaptchaResponse
- type Registration
- type User
- type Username
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUser ¶
func AddUser(clients *conn.Clients, ur *Registration, rr *RecaptchaResponse) (int64, error)
AddUser inserts user into user table
func ChangePassword ¶
ChangePassword changes a user's password
func DeleteAbout ¶
DeleteAbout deletes user_profile details of a user
func GetUsername ¶
GetUsername gets username by id
Types ¶
type About ¶
type About struct { Title string `db:"title,omitempty" json:"title,omitempty"` About string `db:"about,omitempty" json:"about,omitempty"` }
About contains user_profile details
type IDs ¶
type IDs struct {
IDs []int64 `json:"ids" validate:"required"`
}
IDs contains a list of user IDs
type Login ¶
type Login struct { Username string `json:"username" validate:"required,min=3,max=20,alphanum"` Password string `json:"password" validate:"required,min=6,max=255"` }
Login contains user login details
type PasswordChange ¶
type PasswordChange struct { OldPassword string `json:"oldPassword" validate:"required,min=6,max=255"` NewPassword string `json:"newPassword" validate:"required,min=6,max=255"` }
PasswordChange for a user changing passwords
type RecaptchaResponse ¶
type RecaptchaResponse struct { Success bool `json:"success"` ChallengeTS string `json:"challenge_ts"` Hostname string `json:"hostname"` Score float64 `json:"score"` Action string `json:"action"` ErrorCodes []string `json:"error-codes"` }
RecaptchaResponse recaptcha response from verification step See: https://developers.google.com/recaptcha/docs/v3
type Registration ¶
type Registration struct { Username string `json:"username" validate:"required,min=3,max=20,alphanum"` Password string `json:"password" validate:"required,min=6,max=255"` Email string `json:"email" validate:"required,email"` RecaptchaToken string `json:"recaptchaToken" validate:"required"` }
Registration contains user registration details
type User ¶
type User struct { ID int64 `db:"id_user,omitempty" json:"id,omitempty"` Username string `db:"username,omitempty" json:"username,omitempty"` Password string `db:"password,omitempty" json:"-"` Email string `db:"email,omitempty" json:"email,omitempty"` Created string `db:"created,omitempty" json:"created,omitempty"` Modified string `db:"modified,omitempty" json:"modified,omitempty"` }
User contains contains data from user tables
Click to show internal directories.
Click to hide internal directories.