Documentation ¶
Index ¶
- Constants
- func GenerateUsername(n int) string
- func GetUser(ctx iris.Context) (*auth.User, error)
- func LoginRequire(ctx iris.Context)
- func MakePassword(password string) string
- func Register(app *iris.Application, apiPrefix string)
- func UserIDAuth(ctx iris.Context) *auth.User
- type AuthController
- type AuthUser
- type IAuthController
- type LoginByPwdSerializer
Constants ¶
View Source
const ENCRYPTION_TIMES = 10000
Variables ¶
This section is empty.
Functions ¶
func GenerateUsername ¶
func MakePassword ¶
func UserIDAuth ¶
Types ¶
type AuthController ¶
type AuthController struct { }
func (*AuthController) PostLoginbypwd ¶
func (c *AuthController) PostLoginbypwd(ctx iris.Context) response.IRFResult
@Summary 根据用户手机号和密码获取 token @Tags auth @Accept json @Description ### 返回:200 @Description ``` @Description { @Description "code": 0 @Description "data": { @Description "token": "eameeljfaldkfaldkf.alkfjelfkelfe.alekfjelfjkelfjelfj" @Description }, @Description } @Description ``` @Router /auth [post]
type AuthUser ¶
type AuthUser struct { ID string `json:"id" gorm:"primaryKey"` Password string `json:"password"` Username string `json:"username" gorm:"unique"` IsSuperuser bool `json:"is_superuser"` Phone string `json:"phone"` IsActive bool `json:"is_active"` CreatedAt datatypes.IRFTime `json:"created_at" gorm:"autoCreateTime"` IsDel soft_delete.DeletedAt `json:"is_del" gorm:"softDelete:flag"` }
用户表 实现 auth.IUserModel
func CreateAuthUser ¶
type IAuthController ¶
func NewAuthController ¶
func NewAuthController() IAuthController
type LoginByPwdSerializer ¶
type LoginByPwdSerializer struct { Phone string `json:"phone" validate:"number,len=11"` Password string `json:"password" validate:"min=6,max=12"` }
手机号登录
Click to show internal directories.
Click to hide internal directories.