Documentation ¶
Index ¶
- func EmailFound(email string) bool
- func InsertUser(payload *migrations.Users) error
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func MyProfile(c *gin.Context)
- func Register(c *gin.Context)
- func RequestResetPassword(c *gin.Context)
- func ResetPassword(c *gin.Context)
- func UpdateAccessToken(c *gin.Context)
- func UpdateUserPassword(email, password string) error
- func UsernameFound(username string) bool
- type EmailRequestResetPassword
- type PayloadLogin
- type PayloadRegister
- type PayloadRequestResetPassword
- type PayloadResetPassword
- type ResetPasswordStruct
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmailFound ¶
EmailFound to check email address already use or not
func Register ¶
Register POST /authentication/register
This function used for register user with default roles, this is just an example. You can adjust to your needs.
func RequestResetPassword ¶
RequestResetPassword POST /authentication/request/reset-password
Request to reset password account
func ResetPassword ¶
ResetPassword POST /authentication/reset-password
Reset password after receive the security code to reset a password
func UpdateUserPassword ¶
UpdateUserPassword to updating a user data
func UsernameFound ¶
UsernameFound to check username already use or not
Types ¶
type EmailRequestResetPassword ¶
type EmailRequestResetPassword struct {
SecretCode string
}
EmailRequestResetPassword model reference to send email request reset password
type PayloadLogin ¶
type PayloadLogin struct { Username string `form:"username" json:"username" binding:"required"` Password string `form:"password" json:"password" binding:"required"` }
PayloadLogin model references to request /authentication/login
type PayloadRegister ¶
type PayloadRegister struct { Email string `form:"email" json:"email" binding:"required"` Username string `form:"username" json:"username" binding:"required"` Password string `form:"password" json:"password" binding:"required"` Fullname string `form:"fullname" json:"fullname" binding:"required"` Role string `form:"role" json:"role" binding:"required"` }
PayloadRegister model references to request /authentication/register
type PayloadRequestResetPassword ¶
type PayloadRequestResetPassword struct {
Email string `form:"email" json:"email" binding:"required"`
}
PayloadRequestResetPassword model references to request /authentication/request/reset-password
type PayloadResetPassword ¶
type PayloadResetPassword struct { SecureCode string `form:"secure_code" json:"secure_code" binding:"required"` Password string `form:"password" json:"password" binding:"required"` }
PayloadResetPassword model reference to request /authentication/reset-password
type ResetPasswordStruct ¶
type ResetPasswordStruct struct { UUID string `json:"uuid,omitempty"` Email string `json:"email,omitempty"` Code string `json:"code,omitempty"` }
ResetPasswordStruct reference to JSON structure for Redis cache. The unique code only be used for 30 minutes