Documentation ¶
Overview ¶
Package handler contains http handlers for the REST interface.
Index ¶
- type UsersHandler
- func (h *UsersHandler) Activate(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) CheckPasswordStrength(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) Login(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) RefreshToken(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) Register(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) RequestPasswordReset(res http.ResponseWriter, req *http.Request)
- func (h *UsersHandler) ResetPassword(res http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UsersHandler ¶
type UsersHandler struct {
// contains filtered or unexported fields
}
UsersHandler contains user related http handlers.
func NewUsersHandler ¶
func NewUsersHandler(ur repository.Users, jwt *token.JWT, sender send.Sender, externalURL string, frontendPasswordResetPath string, log lax.Logger, ) *UsersHandler
NewUsersHandler creates users handler.
func (*UsersHandler) Activate ¶
func (h *UsersHandler) Activate(res http.ResponseWriter, req *http.Request)
Activate activates user account.
@Tags users @Accept json @Produce json @Router /users/activate/{token} [get] @Param token path string true "Activation token" @Success 200 {object} response.User @Failure 400 {object} response.Error @Failure 404 {object} response.Error @Failure 500 @Summary Activate user account.
func (*UsersHandler) CheckPasswordStrength ¶
func (h *UsersHandler) CheckPasswordStrength(res http.ResponseWriter, req *http.Request)
CheckPasswordStrength calculates password strength.
@Tags users @Accept json @Produce json @Router /users/check-password [post] @Param password body request.Password true "Password" @Success 200 @Failure 400 {object} response.Error @Summary Calculate password strength.
func (*UsersHandler) Login ¶
func (h *UsersHandler) Login(res http.ResponseWriter, req *http.Request)
Login logins user.
@Tags users @Accept json @Produce json @Router /users/login [post] @Param user body request.UserLogin true "User" @Success 201 {object} response.User @Failure 400 {object} response.Error @Failure 401 {object} response.Error @Failure 404 {object} response.Error @Failure 500 @Summary Login.
func (*UsersHandler) RefreshToken ¶
func (h *UsersHandler) RefreshToken(res http.ResponseWriter, req *http.Request)
RefreshToken refreshes JWT authentication token.
func (*UsersHandler) Register ¶
func (h *UsersHandler) Register(res http.ResponseWriter, req *http.Request)
Register registers new users.
@Tags users @Accept json @Produce json @Router /users [post] @Param user body request.UserRegistration true "User" @Success 201 {object} response.User @Failure 400 {object} response.Error @Failure 409 {object} response.Error @Failure 500 @Summary Register user account.
func (*UsersHandler) RequestPasswordReset ¶
func (h *UsersHandler) RequestPasswordReset(res http.ResponseWriter, req *http.Request)
RequestPasswordReset requests password reset.
@Tags users @Accept json @Produce json @Router /users/reset-password [post] @Param email body request.Email true "E-mail address" @Success 202 @Failure 400 {object} response.Error @Failure 404 {object} response.Error @Failure 500 @Summary Request password reset.
func (*UsersHandler) ResetPassword ¶
func (h *UsersHandler) ResetPassword(res http.ResponseWriter, req *http.Request)
ResetPassword sets new user's password.
@Tags users @Accept json @Produce json @Router /users/reset-password [patch] @Param resetPassword body request.ResetPassword true "Password reset token and new password" @Success 200 {object} response.User @Failure 400 {object} response.Error @Failure 404 {object} response.Error @Failure 500 @Summary Set new user's password.
Directories ¶
Path | Synopsis |
---|---|
Package request contains request data structures and related functions.
|
Package request contains request data structures and related functions. |
Package response contains response data structures and related functions.
|
Package response contains response data structures and related functions. |
Package token contains token generation implementations.
|
Package token contains token generation implementations. |