Documentation ¶
Index ¶
- Constants
- type AccountHandler
- func (acc *AccountHandler) AcceptFriendRequest() http.HandlerFunc
- func (acc *AccountHandler) Auth(next http.HandlerFunc) http.HandlerFunc
- func (acc *AccountHandler) GetUserByUsername() http.HandlerFunc
- func (acc *AccountHandler) Login() http.HandlerFunc
- func (acc *AccountHandler) Register() http.HandlerFunc
- func (acc *AccountHandler) SendFriendRequest() http.HandlerFunc
- func (acc *AccountHandler) UploadAvatar() http.HandlerFunc
- type ContextKey
Constants ¶
View Source
const MAX_AVATAR_SIZE int64 = 1 << 20
Maximum avatar size that can be uploaded by a user. Current value is set to 1 MiB
View Source
const PERSIST_SESSION_TIME int = 604800
Time in seconds after which user has to log in manually again. Value set to 7 days.
View Source
const SESSION_TIME int = 5
Time in seconds after which session times out.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountHandler ¶
type AccountHandler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(db *pgxpool.Pool, sessions *redis.Client) *AccountHandler
func (*AccountHandler) AcceptFriendRequest ¶
func (acc *AccountHandler) AcceptFriendRequest() http.HandlerFunc
func (*AccountHandler) Auth ¶
func (acc *AccountHandler) Auth(next http.HandlerFunc) http.HandlerFunc
func (*AccountHandler) GetUserByUsername ¶
func (acc *AccountHandler) GetUserByUsername() http.HandlerFunc
func (*AccountHandler) Login ¶
func (acc *AccountHandler) Login() http.HandlerFunc
func (*AccountHandler) Register ¶
func (acc *AccountHandler) Register() http.HandlerFunc
Handles user registration. Validates values given in request body, then hashes password and inserts user into database. TODO: Email code verification
func (*AccountHandler) SendFriendRequest ¶
func (acc *AccountHandler) SendFriendRequest() http.HandlerFunc
func (*AccountHandler) UploadAvatar ¶
func (acc *AccountHandler) UploadAvatar() http.HandlerFunc
TODO: S3 upload
Click to show internal directories.
Click to hide internal directories.