UserLoginReq (vo/user.go)

goraven · backend/vo/user.go · go · Apache-2.0
auth, database

Defines Go structs for user authentication, captcha, and admin user management in a backend service.

// Source: https://github.com/8treenet/goraven | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package vo

import "time"

// UserLoginReq 用户登录请求
// 前端传明文密码,后端统一做 MD5 哈希
type UserLoginReq struct {
	Username      string `json:"username" validate:"required"` // 用户名
	Password      string `json:"password" validate:"required"` // 明文密码
	CaptchaAnswer int    `json:"captchaAnswer"`                // 算术验证码答案;后端开启防护时必填
}

// UserLoginRsp 用户登录响应
type UserLoginRsp struct {
	AccessToken string `json:"accessToken"` // 访问令牌
}

// CaptchaReq 拉取登录验证码请求
type CaptchaReq struct {
	Username string `url:"username" validate:"required"` // 用户名
}

// CaptchaRsp 拉取登录验证码响应
// Required=false 时无需展示验证码,登录可不带 Ca

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key