login

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterLoginRoutes added in v0.0.145

func RegisterLoginRoutes(r chi.Router)

Types

type Controller added in v0.0.145

type Controller struct{}

func (*Controller) LoginByPassword added in v0.0.145

func (lc *Controller) LoginByPassword(c *response.Context)

验证用户名和密码 1、从cfg中获取用户名,先判断是不是admin,是进行密码比对.必须启用临时管理员配置才进行这一步 2、从DB中获取用户名密码 @Summary 用户登录 @Description 用户通过用户名、密码和2FA验证码登录,支持普通和LDAP登录 @Param username body string true "用户名" @Param password body string true "密码(加密)" @Param loginType body int false "登录类型 0:普通 1:LDAP" @Param code body string false "2FA验证码" @Success 200 {object} string "登录成功,返回JWT Token" @Failure 401 {object} string "登录失败" @Router /auth/login [post]

type Request added in v0.0.145

type Request struct {
	Username  string `json:"username" binding:"required"`
	Password  string `json:"password" binding:"required"`
	LoginType int    `json:"loginType"` // 0: 普通登录, 1: LDAP登录
	Code      string `json:"code"`
}

Request 用户结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL