mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 12:40:25 +08:00
feat: 发布v2.2.25
This commit is contained in:
@@ -73,10 +73,28 @@ func (r *UserController) Login(ctx http.Context) http.Response {
|
||||
// @Success 200 {object} SuccessResponse
|
||||
// @Router /panel/user/logout [post]
|
||||
func (r *UserController) Logout(ctx http.Context) http.Response {
|
||||
ctx.Request().Session().Forget("user_id")
|
||||
if ctx.Request().HasSession() {
|
||||
ctx.Request().Session().Forget("user_id")
|
||||
}
|
||||
|
||||
return Success(ctx, nil)
|
||||
}
|
||||
|
||||
// IsLogin
|
||||
//
|
||||
// @Summary 是否登录
|
||||
// @Tags 用户鉴权
|
||||
// @Produce json
|
||||
// @Success 200 {object} SuccessResponse
|
||||
// @Router /panel/user/isLogin [get]
|
||||
func (r *UserController) IsLogin(ctx http.Context) http.Response {
|
||||
if !ctx.Request().HasSession() {
|
||||
return Success(ctx, false)
|
||||
}
|
||||
|
||||
return Success(ctx, ctx.Request().Session().Has("user_id"))
|
||||
}
|
||||
|
||||
// Info
|
||||
//
|
||||
// @Summary 用户信息
|
||||
|
||||
@@ -8,7 +8,7 @@ func init() {
|
||||
config := facades.Config()
|
||||
config.Add("panel", map[string]any{
|
||||
"name": "耗子面板",
|
||||
"version": "v2.2.24",
|
||||
"version": "v2.2.25",
|
||||
"ssl": config.Env("APP_SSL", false),
|
||||
// 安全入口
|
||||
"entrance": config.Env("APP_ENTRANCE", "/"),
|
||||
|
||||
@@ -32,6 +32,7 @@ func Api() {
|
||||
userController := controllers.NewUserController()
|
||||
r.Middleware(frameworkmiddleware.Throttle("login")).Post("login", userController.Login)
|
||||
r.Post("logout", userController.Logout)
|
||||
r.Get("isLogin", userController.IsLogin)
|
||||
r.Middleware(middleware.Session()).Get("info", userController.Info)
|
||||
})
|
||||
r.Prefix("task").Middleware(middleware.Session()).Group(func(r route.Router) {
|
||||
|
||||
Reference in New Issue
Block a user