Documentation ¶
Index ¶
- func ActivateUser(c *gin.Context) (model.User, int, error)
- func AddRoleToUser(c *gin.Context) (int, error)
- func ClearCookie(c *gin.Context) (int, error)
- func CreateUser(c *gin.Context) (int, error)
- func CreateUserAuthentication(c *gin.Context) (int, error)
- func CreateUserFromForm(registrationForm RegistrationForm) (model.User, error)
- func CurrentUser(c *gin.Context) (model.User, error)
- func CurrentUserByToken(token string) (model.User, error)
- func DeleteUser(c *gin.Context) (int, error)
- func EmailVerification(c *gin.Context) (int, error)
- func GetAuthToken(c *gin.Context) (string, error)
- func RegisterHanderFromForm(c *gin.Context, registrationForm RegistrationForm) (int, error)
- func RegisterHandler(c *gin.Context) (int, error)
- func RemoveRoleFromUser(c *gin.Context) (int, error)
- func ResetPassword(c *gin.Context) (int, error)
- func RetrieveCurrentUser(c *gin.Context) (model.User, int, error)
- func RetrieveUser(c *gin.Context) (*model.PublicUser, bool, uint, int, error)
- func RetrieveUserByEmail(c *gin.Context) (*model.PublicUser, string, int, error)
- func RetrieveUserByUsername(c *gin.Context) (*model.PublicUser, string, int, error)
- func RetrieveUserForAdmin(c *gin.Context) (model.User, int, error)
- func RetrieveUsers(c *gin.Context) []*model.PublicUser
- func RetrieveUsersByEmail(c *gin.Context) []*model.PublicUser
- func RetrieveUsersForAdmin(c *gin.Context) []model.User
- func SendEmailPasswordResetToken(to string, token string, locale string) error
- func SendEmailVerfication(to string, token string, locale string) error
- func SendPasswordResetToken(c *gin.Context) (int, error)
- func SendVerification(c *gin.Context) (int, error)
- func SendVerificationToUser(user model.User) (int, error)
- func SetCookie(c *gin.Context, token string) (int, error)
- func SetCookieHandler(c *gin.Context, email string, pass string) (int, error)
- func SuggestUsername(username string) string
- func Token(c *gin.Context) (string, error)
- func UpdateUser(c *gin.Context) (*model.User, int, error)
- func UpdateUserCore(user *model.User) (int, error)
- type ActivateForm
- type LoginForm
- type PasswordForm
- type PasswordResetForm
- type RegistrationForm
- type SendPasswordResetForm
- type UserForm
- type UserRoleForm
- type VerifyEmailForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateUser ¶
ActivateUser toggle activation of a user.
func AddRoleToUser ¶
AddRoleToUser adds a role to a user.
func CreateUserAuthentication ¶
CreateUserAuthentication creates user authentication.
func CreateUserFromForm ¶
func CreateUserFromForm(registrationForm RegistrationForm) (model.User, error)
CreateUserFromForm creates a user from a registration form.
func EmailVerification ¶
EmailVerification verifies an email of user.
func RegisterHanderFromForm ¶
func RegisterHanderFromForm(c *gin.Context, registrationForm RegistrationForm) (int, error)
RegisterHanderFromForm sets cookie from a RegistrationForm.
func RegisterHandler ¶
RegisterHandler sets a cookie when user registered.
func RemoveRoleFromUser ¶
RemoveRoleFromUser removes a role from a user.
func ResetPassword ¶
ResetPassword resets a password of user.
func RetrieveCurrentUser ¶
RetrieveCurrentUser retrieves a current user.
func RetrieveUser ¶
RetrieveUser retrieves a user.
func RetrieveUserByEmail ¶
RetrieveUserByEmail retrieves a user by an email
func RetrieveUserByUsername ¶
RetrieveUserByUsername retrieves a user by username.
func RetrieveUserForAdmin ¶
RetrieveUserForAdmin retrieves a user for an administrator.
func RetrieveUsers ¶
func RetrieveUsers(c *gin.Context) []*model.PublicUser
RetrieveUsers retrieves users.
func RetrieveUsersByEmail ¶
func RetrieveUsersByEmail(c *gin.Context) []*model.PublicUser
RetrieveUsersByEmail retrieves users by an email
func RetrieveUsersForAdmin ¶
RetrieveUsersForAdmin retrieves users for an administrator.
func SendEmailPasswordResetToken ¶
SendEmailPasswordResetToken sends a password reset token via email.
func SendEmailVerfication ¶
SendEmailVerfication sends an email verification token via email.
func SendPasswordResetToken ¶
SendPasswordResetToken sends a password reset token.
func SendVerification ¶
SendVerification sends an email verification token.
func SendVerificationToUser ¶
SendVerificationToUser sends an email verification token to user.
func SetCookieHandler ¶
SetCookieHandler sets a cookie with email and password.
func SuggestUsername ¶
SuggestUsername suggest user's name if user's name already occupied.
func UpdateUser ¶
UpdateUser updates a user.
Types ¶
type ActivateForm ¶
type ActivateForm struct {
Activation bool `form:"activation" binding:"required"`
}
ActivateForm is used when activating user.
type LoginForm ¶
type LoginForm struct { Email string `form:"loginEmail" binding:"required"` Password string `form:"loginPassword" binding:"required"` }
RegistrationForm is used when creating a user authentication.
type PasswordForm ¶
type PasswordForm struct { CurrentPassword string `form:"currentPassword" binding:"required"` Password string `form:"newPassword" binding:"required"` }
PasswordForm is used when updating a user password.
type PasswordResetForm ¶
type PasswordResetForm struct { PasswordResetToken string `form:"token" binding:"required"` Password string `form:"newPassword" binding:"required"` }
PasswordResetForm is used when reseting a password.
type RegistrationForm ¶
type RegistrationForm struct { Username string `form:"registrationUsername" binding:"required"` Email string `form:"registrationEmail" binding:"required"` Password string `form:"registrationPassword" binding:"required"` }
RegistrationForm is used when creating a user.
type SendPasswordResetForm ¶
type SendPasswordResetForm struct {
Email string `form:"email" binding:"required"`
}
SendPasswordResetForm is used when sending a password reset token.
type UserRoleForm ¶
type UserRoleForm struct { UserId int `form:"userId" binding:"required"` RoleId int `form:"roleId" binding:"required"` }
UserRoleForm is used when adding or removing a role from a user.
type VerifyEmailForm ¶
type VerifyEmailForm struct {
ActivationToken string `form:"token" binding:"required"`
}
VerifyEmailForm is used when verifying an email.